I have just written simple script to launch an applciation and I am trying to use "SendKeys" module to send keystrokes to this application. There is one "Snapshot"
button, but I cant get Python to click "Snapshot"
button, as the new window is not in focus. So I am planning to use Win32gui module's win32gui.FindWindow
and win32gui.SetForegroundWindow
functionality. But it gives me error- invalid handle
. My app name is "DMCap"
Here is code snippet in Python:
handle = win32gui.FindWindow(0, "DMCap") //paassing 0 as I dont know classname
win32gui.SetForegroundWindow(handle) //put the window in foreground
Can anyone help me? Is this Python code correct? Can I send handle directly like this?