Article View: borland.public.cppbuilder.nativeapi
Article #14202Tray Icon + popup menu
From: Boguslaw Fries
Date: Thu, 04 Sep 2003 13:08
Date: Thu, 04 Sep 2003 13:08
40 lines
2044 bytes
2044 bytes
Hello,
my application have icon in Tray - using AddTrayIcon ( Handle,
IconHandle );
I have the program generated popup menu - using
...
pMenu = new TMenu( this );
......
pMenuItem = new TMenuItem( pMenu );
pMenuItem->Caption = "Any";
pMenuItem->OnClick = AboutClick;
pMenu->Items->Insert( 0, pMenuItem );
...
void __fastcall TForm1::AboutClick(TObject *Sender)
{
}
void TForm1::AddTrayIcon ( HWND Handle, HWND IconHandle )
{
NOTIFYICONDATA icondata;
memset (&icondata, 0, sizeof ( icondata ));
icondata.cbSize = sizeof ( icondata );
icondata.hWnd = Handle;
strncpy ( icondata.szTip, "myapp", sizeof ( icondata.szTip ));
icondata.hIcon = IconHandle;
icondata.uCallbackMessage = WM_RBUTTONUP;
icondata.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
Shell_NotifyIcon ( NIM_ADD, &icondata );
}
And finally - how to assotiate this Icon withs this Popup menu ( when I
righ click over the icon )
Best regards
Boguslaw Fries
Technical Details
Message-ID:
<3f57393f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!hermes.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsoutpeer00.lnd.ops.eu.uu.net!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c117fcea15cf7df7,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-04 06:09:49 PST From: "Boguslaw Fries" <B.Fries@luca-online.de> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Tray Icon + popup menu Date: Thu, 4 Sep 2003 15:08:14 +0200 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 217.255.152.10 Message-ID: <3f57393f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1062680895 217.255.152.10 (4 Sep 2003 06:08:15 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!hermes.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsoutpeer00.lnd.ops.eu.uu.net!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail