🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6575

Re: Missing Tray Icon

#6575
From: Vladimir Stefanovic
Date: Mon, 02 May 2005 18:18
60 lines
2796 bytes
Remy, will this be enough?

--- H ---
   private: // User declarations
   UINT WM_TASKBARRECREATED;


--- CPP ---
   __fastcall TForm1::TForm1(TComponent* Owner)
           : TForm(Owner)
   {
      // ...
      WM_TASKBARRECREATED = RegisterWindowMessage( "TaskbarCreated" );
      // ...
   }

   void __fastcall TForm1::WndProc( TMessage &Msg )
   {
      if ( ( Msg.Msg != 0 ) && ( Msg.Msg == WM_TASKBARRECREATED ) )
      {
         DoSomethingToRecreateTrayIcon();
      }
      // ...
   }


-- 
Best regards,
Vladimir Stefanovic
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:4275d933$1@newsgroups.borland.com...
>
> "Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote in message
> news:427522d4@newsgroups.borland.com...
>
>> I noticed that in some circumstances (do not know the moment)
>> a tray icon of my program is missing, although the task manager
>> says that the app is running. The funy thing is that also many other
>> tray icons are missing (not only mine) when that moment happens!
>
> That happens when the OS's shell program (explorer.exe) crashes and was
> re-started by the OS, thus every icon was lost when the System Tray was
> recreated.  Those icons that "survived" were because their respective
> applications recognized the restart and re-added their icons accordingly.
>
>> I suppose that the programs that "survived" know about that
>> problem and so has some additional code to add the icon again.
>
> Yes.  At program startup, use the RegisterWindowMessage() function to
> register the "TaskbarCreated" message.  Then override your form's 
> WndProc()
> method to catch that message.  When your form receives the message, it 
> means
> that the entire Taskbar, including the System Tray, has been recreated, so
> you can then re-add your icons at that time.
>
>
> Gambit
>
> 
Technical Details
Message-ID: <42766edf@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <427522d4@newsgroups.borland.com> <4275d933$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7ad711a9c0d3d8ff
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <427522d4@newsgroups.borland.com> <4275d933$1@newsgroups.borland.com>
Subject: Re: Missing Tray Icon
Date: Mon, 2 May 2005 20:18:11 +0200
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.117.212.65
Message-ID: <42766edf@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115057887 82.117.212.65 (2 May 2005 11:18:07 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail