Using Pythonwin to poke at Windows apps?
Henrik.Weber at sdm.de
Tue Mar 9 15:00:15 CET 2004
I'm trying to read information about widgets from running instances of
win32 applications. My current victim is the Explorer on a XP box. I'm
trying to access the menu bar. On XP this is not a standard menu but a
toolbar. So far I can retrieve a PyCWnd object with win32ui:
>>> e = win32ui.FindWindow("ExploreWClass", None)
>>> w = win32ui.FindWindowEx(e, None, "WorkerW", None)
>>> w = win32ui.FindWindowEx(w, None, "ReBarWindow32", None)
>>> t = win32ui.FindWindowEx(w, None, "ToolbarWindow32", None)
>>> t = win32ui.FindWindowEx(w, t, "ToolbarWindow32", None)
>>> print t
object 'PyCWnd' - assoc is 01275A88, vi=<None>, notify=0,ch/u=0/0,
I know that t now refers to a ToolbarWindow32 widget but seemingly
win32ui doesn't. Is there a way to get a PyCToolbar object from this?
Or do I have to continue by sending messages? I tried sending a
TB_GETBUTTON message with win32gui.SendMessage, using a Python array
to reserve some memory for the TBBUTTON structure, but so far I have
only succeeded in crashing the Explorer. What would be the right way
to send a message that needs some memory to put the results into?
More information about the Python-list