We are integrating a 3rd party app into ours, part of doing this we will provide access to their functionality through our system tray icon however need to suppress their tray icon so there are not duplicate icons. I am aware of the shell_notifyicon(NIM_DELETE,...) The problem is the ... how can one enumerate the icons to get the NOTIFYICONDATA structures? Or if I get the Icon ID from the 3rd party (not sure if this is static or dynamic some examples showed it to be static but that doesn't make sense) will this help if I create a new NOTIFYICONDATA structure with this info? Any help is appreciated.
The problem with doing this for another app is that the other app can update or create an icon at anytime. So if you hide the icon, the app can update or insert a new icon immediately afterword.
Enumerating the NOTIFYICONDATA structures won't help you (even if you could enumerate them) because they would be in the context of the other process space. For them to be meaningful, you'd need to be in the other app's process space.
About the only way to do this (that I can think of) is to locate the icon using Active Accessibility and change its state to hidden.
Thanks for the response Arjay, as for the other app updating it's icon their developers tell me that is not happening so it "should" be safe. As for the NOTIFYICONDATA structure that makes sense I was hoping the icons were registered with a uid in Windows somehow that would allow me to generate a NOTIFYICONDATA structure with the correct uid. Anyway, how would one go about doing this with Active Accessibility? (Googling it now myself) Thanks again.
As for the NOTIFYICONDATA structure that makes sense I was hoping the icons were registered with a uid in Windows somehow that would allow me to generate a NOTIFYICONDATA structure with the correct uid.
In NOTIFYICONDATA hWnd and uID make the pair that uniquely identifies the icon in tray. So you need to know both to handle the icon from outside.
See the sample attached: the app spawns another app that deletes its icon.
Last edited by Igor Vartanov; November 19th, 2010 at 04:32 PM.