[python-win32] Win32 service with tray icon

Larry Bates larry.bates at websafe.com
Wed May 9 15:41:56 CEST 2007


Mark Hammond wrote:
>> I'm writing a win32 service in Python.  I'd like to add a
>> tray icon displayed
>> whenever the service is running.  I have played around with
>> SysTrayIcon.py
>> [1], but if a user logs off and logs back on, the tray icon
>> disappears even
>> though the service is still running.  I think the answer is
>> probably getting
>> my service to recreate the icon whenever a logon event
>> happens.  I don't
>> really know much about win32 programming, though.  Can
>> someone point me in
>> the right direction to solve this problem?
> 
> Services have trouble interacting with the desktop.  The general approach is
> to have a dedicated taskbar application that communicates with the dedicated
> service using some kind of IPC.
> 
> Mark

Mark,

Please accept my apology for hijacking this thread, but it is exactly
what I want to implement.  I have a COM object that is doing an upload.
I want a system tray icon that:

1) Shows a heartbeat (upload progress indicator)
2) Provides the user with a way to cancel the upload

I found systrayicon.py and it almost does what I want.  I thought
about using socket server/client to have the two apps communicate
but I'm at a complete loss as to how to implement socket client
in the systrayicon.py program since it uses PumpMessages.  I just
don't see how to connect to my com server (which would also be
a socket server) inside some loop mechanism.

Thanks in advance for any assistance.

Regards,
Larry Bates



More information about the Python-win32 mailing list