I'm creating a script that will send mouse inputs to a specific window. The only way I have found to do this is by setting focus to the window. If there is another way please explain it. Anyways, this is the code that is not working.
from win32gui import *
us_ip = input('Version of Minecraft: ')
minecraft_handle = FindWindow(None, f'Minecraft {us_ip}')
SetFocus(minecraft_handle)
I can retrieve the HWND but when I run the program I get this error.
Traceback (most recent call last):
File "c:\Users\Jacob Daniels\Desktop\python\autoclicker\windows api experimentation\py.py", line 5, in <module>
SetFocus(minecraft_handle)
pywintypes.error: (5, 'SetFocus', 'Access is denied.')
Any help will be appreciated. Documentation for library: http://timgolden.me.uk/pywin32-docs/win32_modules.html edit: posted wrong error message