Re: system tray icons lost if explorer shuts down/re-starts

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Michel (mrodenas_at_iFrance.com)
Date: 02/13/05


Date: Sun, 13 Feb 2005 11:35:51 +0100


Tom Esh a écrit :
> On Sat, 12 Feb 2005 06:14:48 -0000, "Pedro CR"
> <pramilo@n0.spam.sapo.pt> wrote:
>
>
>>i have an app that places an icon in the system tray and the main form can
>>only be shown by clicking the icon in the systray.
>>the app ensures that it's the only instance running to prevent having
>>multiple icons in the system tray for the same purpose
>>
>>however i have a problem: if for any reason windows explorer is terminates,
>>when it re-starts the icon is no longer in the system tray but the app is
>>still running.
>>Users complain that they must reboot to get the program working again.
>>i've noticed that some software is able to recover from this problem and as
>>soon as windows explorer re-starts some icons re-appear.
>>
>>must i use some hack when I add the app to the system tray? I'm using the
>>regular NIM_ADD with flags "NIF_ICON Or NIF_MESSAGE Or NIF_TIP".
>>is there any way to work around this issue?
>
>
> Yes. When the shell re-starts it broadcasts the "TaskbarCreated"
> registered message and tray apps should respond by re-initializing
> (adding) whatever tray icons. Use the RegisterWindowMessage Api
> function at runtime to obtain the actual message value, and add a
> handler for it in your subclassed winproc.
>
> I believe the "Tray" example at http://vb.mvps.org/ demonstrates it.
>
>
> -Tom
> MVP - Visual Basic
> (please post replies to the newsgroup)

I dont remember where I've found this sample but that's exactly what you
are looking for, really really good.
Michel






Relevant Pages

  • Re: Tray Icons and custom shell
    ... messages to SysTray to forwarding WM_COMMAND event to some other parts or windows of the same app). ... PostMessage to send the appropriate command to the tray icon window. ... I've a custom shell and therefore no system tray. ...
    (microsoft.public.windowsxp.embedded)
  • Re: system tray icons lost if explorer shuts down/re-starts
    ... >only be shown by clicking the icon in the systray. ... >the app ensures that it's the only instance running to prevent having ... >when it re-starts the icon is no longer in the system tray but the app is ...
    (microsoft.public.vb.controls)
  • Re: system tray icons lost if explorer shuts down/re-starts
    ... >only be shown by clicking the icon in the systray. ... >the app ensures that it's the only instance running to prevent having ... >when it re-starts the icon is no longer in the system tray but the app is ...
    (microsoft.public.vb.winapi)
  • Re: System Tray Icon Actions
    ... > menu appear when I right click on the icon in the system tray. ... > the icon in the tray and have my app show (it hides when the user clicks ... you should probably add a "Show" menu command (give it ...
    (microsoft.public.vb.general.discussion)
  • Re: system tray icons lost if explorer shuts down/re-starts
    ... >>i have an app that places an icon in the system tray and the main form can ... >>only be shown by clicking the icon in the systray. ... > registered message and tray apps should respond by re-initializing ...
    (microsoft.public.vb.winapi)