🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Resource files???

#5629
From: Mike Collins
Date: Fri, 05 Aug 2005 17:06
60 lines
3061 bytes
Don't know if this helps, as I'm not 100% on trayicons but,
1) LoadIcon has been superseeded by LoadImage:

    LoadImage(HInstance, "DISABLEDICON", IMAGE_ICON, 16, 16, 
LR_DEFAULTSIZE);

2) Form what I remember, there's a TrayIcon vcl that comes with builder and 
uses an TImageList to hold the various images that you may wish to assign.

3) My experiance of including other resource files with the automatically 
generated (AG) resource file has thrown up many problems.  I've always found 
that when the reource linker tries to combine my other resource with the AG 
resource file I get errors or the combination does not occure as predicted. 
Generally I always remove the AG resource file and replace it with a 
completely new one (including main icon, version info and other resource) 
created in Visual C++ (thats the only thing it's good for).

4) Have you tested handle that is returned from LoadIcon to see if it is 
sucessful?

Just some thoughts,

HIH

Mike C


"Jeff" <Jeff@nospam.com> wrote in message 
news:42f39510@newsgroups.borland.com...
> I'm have a heck of a time trying to get a tray icon to change during 
> runtime. I've added a second icon to my resource file, using Borland's 
> Image Editor, but the image doesn't appear to be in the exe? I use the 
> LoadIcon() function to load it during runtime; see code below.
>
> void __fastcall TfrmMain::UpdateIcon(const char *ptr_chrHint, bool 
> boolDisIcon)
> {
>    NOTIFYICONDATA IconData;
>
>    if (boolDisIcon)    //Disabled icon desired
>        IconData.hIcon = LoadIcon(HInstance, "DISABLEDICON");
>    else
>        IconData.hIcon = LoadIcon(HInstance, "MAINICON");
>
>    IconData.cbSize = sizeof(NOTIFYICONDATA);
>    IconData.uID    = IDC_TRAY1;
>    IconData.hWnd   = Handle;
>    IconData.uFlags = NIF_MESSAGE | NIF_TIP;
>    IconData.uCallbackMessage = WM_TRAYNOTIFY;
>    lstrcpy(IconData.szTip, ptr_chrHint);
>
>    Shell_NotifyIcon(NIM_MODIFY,&IconData);
> }
>
> The .res file has been added to the project, and the MAINICON is in there, 
> but what am I missing?
>
> Thanks,
> Jeff
> 
Technical Details
Message-ID: <42f39a73@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!ecngs!feeder.ecngs.de!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42f39510@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e43ccfa66ff1058d
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@thebottomofthe.post>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42f39510@newsgroups.borland.com>
Subject: Re: Resource files???
Date: Fri, 5 Aug 2005 18:06:31 +0100
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
NNTP-Posting-Host: 81.2.92.14
Message-ID: <42f39a73@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1123261043 81.2.92.14 (5 Aug 2005 09:57:23 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!ecngs!feeder.ecngs.de!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail