Hide System Tray Icon for another app...
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Hide System Tray Icon for another app...

  1. #1
    Join Date
    Feb 2009
    Posts
    37

    Hide System Tray Icon for another app...

    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.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,197

    Re: Hide System Tray Icon for another app...

    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.

  3. #3
    Join Date
    Feb 2009
    Posts
    37

    Re: Hide System Tray Icon for another app...

    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.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,925

    Re: Hide System Tray Icon for another app...

    Quote Originally Posted by fxRichard View Post
    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.
    Attached Files Attached Files
    Last edited by Igor Vartanov; November 19th, 2010 at 04:32 PM.
    Best regards,
    Igor

  5. #5
    Join Date
    Feb 2009
    Posts
    37

    Re: Hide System Tray Icon for another app...

    Thanks a ton Igor, I will take a look at the code you provided and see if it helps...will let you know shortly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center