Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - How to tell if a window is in system tray?
  
User name:
Password:
Reply:
 

UserPost
Jesper
Posts: 1331/2390
Shell_NotifyIcon. Unfortunately it's sent directly to shell32.dll so you'll have to find out a way to "listen in".
HyperLamer
Posts: 2202/8210
Thanks, that helps a lot. Now if you just so happened to know what message, and how they send it... (Do they look for a special window, send it to all the windows, etc?)
Jesper
Posts: 1291/2390
The System Tray works like this: people call an API to register a tray icon (provide a tooltip, icon, window handle, process pointer), and later one to unregister them (that's why programs that crash still have their icon there but it disappears when you hover it - Windows sends a mouseover event to the program, notices that it has quit and removes the icon on its own). Explorer.exe receives those messages somehow - you'll have to hack a way to make your shell get those messages instead.
HyperLamer
Posts: 2061/8210
Hmm, so you have to use an image list for icons? Nuts, I was hoping to avoid that. Anyway, I figured there must be some window attribute that tells it? (Can't just be constantly monitoring for it, since if you close/restart it or it crashes, the icons are all still in it.)

Anyway, this code won't work... All it does is patch into the existing taskbar. Mine is a replacement taskbar/shell, so explorer.exe won't be running.
dan
Posts: 240/782
I believe this website should help you a bit: http://skyscraper.fortunecity.com/gigo/311/winprog.html

There's sample C++ code to enumerate the currently displayed tray icons. It seems to actually hook into the tray, which I presume is some kind of hacky way of doing it.
Gavin
Posts: 307/799
Originally posted by dan
Presumably, the system tray just monitors for an application that is trying to put itself in there. There's probably no API functions or anything to enumerate through the applications that put themselves in there. (Well, of course this is only a guess, because when Windows Explorer crashes, the system tray gets emptied too)


that is my understanding of it as well. I was reading up on a document (rather dated, keep in mind) that suggested just that: there is no exact way to determine if a window/form is being kept in the system tray. I suppose if you're emulation of the system tray is targeted at a specific program, your idea could still work. Otherwise, if you are not targeting a specific process, i you might be out of luck.

if you're going to be messing with the taskbar though, look into SHAppBarMessage
dan
Posts: 239/782
Presumably, the system tray just monitors for an application that is trying to put itself in there. There's probably no API functions or anything to enumerate through the applications that put themselves in there. (Well, of course this is only a guess, because when Windows Explorer crashes, the system tray gets emptied too)
Dish
Posts: 193/596
Can't help you with this one... I haven't done any work involving the system tray ever. But I'm kind of interested... so if you find out elsewhere, could you post your findings (or a link to them) in here? ^^
HyperLamer
Posts: 2052/8210
I've been working on a custom taskbar using EnumWindows, and it's working good, but I've hit a problem with emulating the system tray. I need to know how to tell what windows are in it, get their icons, and send mousemove/click/etc messages to them when moving/clicking the tray icons. Any ideas?
Acmlm's Board - I2 Archive - Programming - How to tell if a window is in system tray?


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.011 seconds.