GWL_EXSTYLE = -20
WS_EX_NOACTIVATE = 0x08000000
def set_window_no_activate(handle):
# Get the current extended window style
current_style = ctypes.windll.user32.GetWindowLongW(handle, GWL_EXSTYLE)
# Add WS_EX_NOACTIVATE to the style
new_style = current_style | WS_EX_NOACTIVATE
# Set the modified style
ctypes.windll.user32.SetWindowLongW(handle, GWL_EXSTYLE, new_style)
Here are some things I have noticed.
- When I click on the application as intended the application does not get focused.
- My clicks still register and behave as intended and espected.
- When I click a textfield and start to type in it no text appears in the textfield.
- However if I click on the application icon in my taskbar the application gets focused.
- When I have the app focused by clicking on the application in the taskbar then typing in the textfields work.
Points 1, 2 and 4 are not a problem for me, but points 3 and 5 are. It is pretty frustrating that I cannot type in the textfields when the app is unfocusable.
Is there a way to allow the clicked text field to be typed in while keeping the app not focused?
