Article View: borland.public.cppbuilder.nativeapi
Article #694Re: Multiple Shell_NotifyIcon calls
From: Remy Lebeau (TeamB)
Date: Mon, 25 Feb 2008 18:36
Date: Mon, 25 Feb 2008 18:36
35 lines
2584 bytes
2584 bytes
"Kris" <ks@ks.com> wrote in message
news:47c02cfe$1@newsgroups.borland.com...
> Well, I assumed that the best time to create the icon is when my
> application starts.
Yes, that is fine. But that does no necessarily mean that you are starting
your app at the right time. There are several different places in Windows'
startup where user apps can be loaded automatically. When exactly are you
starting your app?
> This is where I attempt to create my icon during startup:
I would suggest overriding the TForm's virtual CreateWnd() and DestroyWnd()
methods instead of using the constructor. Issue NIM_ADD in CreateWnd() and
in response to "TaskbarCreated" message. Issue NIM_REMOVE in DestroyWnd().
Issue NIM_MODIFY when changing the icon.
> I'm setting it up as soon as possible (during WM_CREATE)
That may be too late, depending on when the TForm's HWND is actually
created. I would suggest calling RegisterWindowMessage() as soon as
possible (in the TForm's constructor, or better in WinMain() directly). You
do not need to use WM_CREATE at all.
> if (Message.Msg==WM_TASKBARCREATED)
Make sure you check for 0 as well, in case RegisterWindowMessage() failed.
0 means WM_NULL, which the VCL uses for other purposes:
if( (Message.Msg==WM_TASKBARCREATED) && (WM_TASKBARCREATED != 0) )
Gambit
Technical Details
Message-ID:
<47c30a92$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<47B85E8F.6040508@ks.com> <47bb1415$1@newsgroups.borland.com> <47bc8219$1@newsgroups.borland.com> <47bc8d05@newsgroups.borland.com> <47bf5bd8$1@newsgroups.borland.com> <47bf6cce$1@newsgroups.borland.com> <47c02cfe$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,fd4854ec85a82474 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <47B85E8F.6040508@ks.com> <47bb1415$1@newsgroups.borland.com> <47bc8219$1@newsgroups.borland.com> <47bc8d05@newsgroups.borland.com> <47bf5bd8$1@newsgroups.borland.com> <47bf6cce$1@newsgroups.borland.com> <47c02cfe$1@newsgroups.borland.com> Subject: Re: Multiple Shell_NotifyIcon calls Date: Mon, 25 Feb 2008 10:36:22 -0800 Lines: 37 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 207.178.157.90 Message-ID: <47c30a92$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1203964562 207.178.157.90 (25 Feb 2008 10:36:02 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail