Given the handle to a parent window, How can I get the handle of a button inside this window?
I'm using win32api.sendMessage( )
to pass values to a window. I want to use BM_CLICK
to click on the button in question.
import win32api
import win32gui
import win32con
#get handle of the window I want
hwnd=win32gui.FindWindow(0,"SOME TITLE")
#btnHnd= (NEED CODE HERE TO GET THE HANDLE OF THE BUTTON INSIDE hwnd)
win32api.SendMessage(btnHnd, win32con.BM_CLICK, 0, 0)
btnHnd= win32api.FindWindowEx(hwnd, 0 , "Button", "#Title")
is the way to find the handle of the child window, provided the button is a direct child of the parent, not just a descendent