Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting programs running in sys tray

Status
Not open for further replies.

VeryFrustrated

Programmer
Jun 21, 2002
7
GB
I want to detect the progs running in my sys tray and then have the option to shut them down (all or some), any pointers? cheers - VF
 
Oh boy...

OK, the icons on the system tray (or, more accurately, tray notofication area) are not some sort of minimised application. All the tray does is get notifications from an app that it wants to put an icon there, and also get's told how to talk back to that application.

In other words all that the tray does is provide a device context that an application can show an image in (except for the clock, which actually has it's own window). So there is no accessible list of child windows or anything like that on the tray.

What you probably can do is insert a message hook. Then, knowing the dimensions of a) the tray and b) a tray icon, you can fake a message to each 'icon' (remember, they are not actually icons). Now, you may be able to intercept those messages (with yur message hook) and see what the destination window is. Yoiu can then use API calls to determine the process/thread API of that window, and thus determine the underlying EXE.

This is all theory. I haven't actually tried it, and the actual details may be inaccurate, but the approach seems sound.

Frankly, however, I'm not sure that it it worth it...
 
You can determine this if the mouse is over one of the items - I never had a need to know any further...
 
OK - thanks for explaining and sorry if I offended - just needed to understand - regards VF
 
No, no, you didn't offend. Sorry if I somehow gave that impression.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top