Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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)
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.