Larry Bates schrieb: > 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.
You set the sockets to non-blocking, and use WSAAsyncSelect to get messages posted to the messageloop when something interesting happens to the socket. I do not know if pywin32 exposes WSAAsyncSelect, otherwise you can use ctypes to call it. Thomas _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32