Using Pythonwin to poke at Windows apps?
From: Henrik Weber (Henrik.Weber_at_sdm.de)
Date: 03/09/04
- Next message: John Roth: "Re: "Virtual" file system mock object - replacing stuff in __builtins__"
- Previous message: Lothar Scholz: "Re: "Virtual" file system mock object - replacing stuff in __builtins__"
- Next in thread: Thomas Heller: "Re: Using Pythonwin to poke at Windows apps?"
- Reply: Thomas Heller: "Re: Using Pythonwin to poke at Windows apps?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 9 Mar 2004 06:00:15 -0800
Hello all,
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)
>>> hex(t.GetSafeHwnd())
'0x602d8'
>>> print t
object 'PyCWnd' - assoc is 01275A88, vi=<None>, notify=0,ch/u=0/0,
mh=0, kh=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?
Thanks
Henrik
- Next message: John Roth: "Re: "Virtual" file system mock object - replacing stuff in __builtins__"
- Previous message: Lothar Scholz: "Re: "Virtual" file system mock object - replacing stuff in __builtins__"
- Next in thread: Thomas Heller: "Re: Using Pythonwin to poke at Windows apps?"
- Reply: Thomas Heller: "Re: Using Pythonwin to poke at Windows apps?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]