Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
I am attempting to create my own shell and am now working on the system tray. I would like to know if there is a way to determine the system tray icon information (ie: If there is an icon, right and left click actions/menus, etc) for open applications or how I can catch the creation/deletion messages for these icons?

I have seen examples of how I can pull the current system tray icons, but this will not work seeing as when my program is complete explorer will not be open.

Through experimentation with Spy++ I have determined that the System Tray receives a TB_INSERTBUTTON message, so my thought was if I could catch this message and determine if it was supposed to go to the system tray I could process it myself.

Using Spy++ I monitored an application that I know creates a tray icon as it opens but found no such message. My guess is, it sends a different message to windows which then processes it and then sends the TB_INSERTBUTTON message to the System Tray.

I know that this is some how possible because I have used other custom shells that contain a System Tray, but I am stuck on how to go about doing it. I do understand that I will either need to use Interop, or maybe write an unmanaged DLL to handle this.

Okay, from further research I have decided that what would most likely be the best way of doing this would be to catch the messages NIM_ADD and such that are for the System Tray but I have no idea of how to accomplish this.
Posted
Updated 5-Dec-10 13:04pm
v4

For future reference to other developers wanting to achieve the same or similar effect: After lots of research and, most of all, help from a fellow developer I have found the answer to this. If a class is created with a custom class name of "Shell_TrayWnd" this class will automatically receive all messages pertaining to the System Tray/Notification Icon area.
 
Share this answer
 
So were you able to pull this?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900