|
-
July 21st, 1999, 08:36 PM
#1
Icon in Tray
Is it possible to create more than one icon in systemtray from my application. My source code:
...
NOTIFYICONDATA nid_yellow;
NOTIFYICONDATA nid_red;
...
nid_red.cbSize = sizeof( NOTIFYICONDATA );
nid_red.hWnd = NULL;
nid_red.uFlags = NIF_ICON | NIF_TIP;
nid_red.hIcon = AfxGetApp()->LoadIcon(IDI_ICON_RED);
strcpy(nid_red.szTip, "RedIcon" );
Shell_NotifyIcon(NIM_ADD, &nid_red); // it's OK here
nid_yellow.cbSize = sizeof( NOTIFYICONDATA );
nid_yellow.hWnd = NULL;
nid_yellow.uFlags = NIF_ICON | NIF_TIP;
nid_yellow.hIcon = AfxGetApp()->LoadIcon(IDI_ICON_YELLOW);
strcpy(nid_yellow.szTip, "YellowIcon");
Shell_NotifyIcon(NIM_ADD, &nid_yellow ); // here doesn't work 
...
What's wrong? Plz help!
Thnx!
-
July 21st, 1999, 10:28 PM
#2
Re: Icon in Tray
for what do you want a second Icon??? Should it shown sometimes the red and sometimes the yellow???
If you want it so, I would do this with CSpanTime (you could say for example, that on monday the yellowone should be there and on Friday the redone.)
I hope it helps you, if not, just don't take any notes it.
Black Racer
-
September 23rd, 1999, 05:38 AM
#3
Re: Icon in Tray
Your problem is, I think, that you must give every Icon an own name (a number).
A name is, e.g., nid_yellow.uID = 77; ....
Try this code:
#define RED_ICON_NAME 234 // I know, abstract numbers, but so you can be sure, that none tray-icon else has this name
#define YELLOW_ICON_NAME 345
NOTIFYICONDATA nid_yellow;
NOTIFYICONDATA nid_red;
...
nid_red.cbSize = sizeof( NOTIFYICONDATA );
nid_red.hWnd = NULL;
nid_red.uID = RED_ICON_NAME;
nid_red.uFlags = NIF_ICON | NIF_TIP;
nid_red.hIcon = AfxGetApp()->LoadIcon(IDI_ICON_RED);
strcpy(nid_red.szTip, "RedIcon" );
Shell_NotifyIcon(NIM_ADD, &nid_red);
nid_yellow.cbSize = sizeof( NOTIFYICONDATA );
nid_yellow.hWnd = NULL;
nid_yellow.uID = YELLOW_ICON_NAME
nid_yellow.uFlags = NIF_ICON | NIF_TIP;
nid_yellow.hIcon = AfxGetApp()->LoadIcon(IDI_ICON_YELLOW);
strcpy(nid_yellow.szTip, "YellowIcon");
Shell_NotifyIcon(NIM_ADD, &nid_yellow );
...
Later if you want to get messages, have a look at the msdn library. A few days ago I wrote a Dll which includes two easy function (of course more, but thats not interesting now):
BOOL AddTrayIcon( HWND, HICON, ... , LONG ICONNAME);
and
BOOL DeleteTrayIcon( HWND, LONG ICONNAME );
If you want to use this Dll, write me an e-mail to
[email protected]
so I can send this Dll to you.
Hope my answear helps you
'Michael
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|