[python-win32] Attaching Menu to Any App

Tim Roberts timr at probo.com
Wed May 14 18:59:51 CEST 2008


otaeris at o2.pl wrote:
> I'm having problem with attaching a subMenu to an application MenuBar. SubMenu is there, hanging from the MenuBar but it doesn't send/respond to any events. 
> How can I get events either by pywin32 or wxpython ?
>
> There is great example sitting here :C:\Python25\Lib\site-packages\win32\Demos\win32gui_taskbar.py
>
> This example is great but how to, instead of using Shell_NotifyIcon(NIM_ADD, nid) connect submenu it to application menubar ?
>   

Are you talking about attaching to a menu in another application?  That 
requires hooking.  You actually have to inject a DLL of your own into 
the code space of the owning process, then override that window's 
windowproc so that you can intercept its window messages.

I would arrogantly assert that this is not possible in Python, although 
I'm sure one of the gurus will be happy to contradict me.  If it were 
me, I would write a small DLL in C to do the hooking and subclass the 
window, then come up with some kind of communication scheme back to my 
Python application.

If I have misunderstood your request, then please excuse me.  What are 
you planning to do in this menu handler?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list