Shell_NotifyIcon
I was wondering if anybody has ever used the NOTIFYICONDATA v5.0 or 6.0 structure?
code:--------------------------------------------------------------------------------
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWndMain;
nid.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CXICON));
nid.uID = 1;
nid.uCallbackMessage = CX_ICON;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_INFO;
strcpy(nid.szInfoTitle, "test.");
strcpy(nid.szInfo,"test");
nid.uVersion = NOTIFYICON_VERSION;
nid.dwInfoFlags = NIIF_INFO;
Shell_NotifyIcon(NIM_ADD, &nid);
--------------------------------------------------------------------------------
I am using this code to dislpay my tray icon. It works, but everytime I go to put my mouse over it, it closes . Any ideas?
thanks
Need a little more info (perhaps more of the code). What is the value of CX_ICON? What do you do in response to the messages sent to your window?
The value of CX_ICON is unimportant. It is as follows:
#define CX_ICON WM_USER+14
In response to it I am currently doing nothing. I just wanted to see if the ballon tip would come up and every thing work as I expected. Do you think that has something to do with it? A
Also, can you tell me how some people on these boards put the code thing in, with the highlighted syntax? Thanks for the reply.
#define CX_ICON WM_USER+14
In response to it I am currently doing nothing. I just wanted to see if the ballon tip would come up and every thing work as I expected. Do you think that has something to do with it? A
Also, can you tell me how some people on these boards put the code thing in, with the highlighted syntax? Thanks for the reply.
I just wanted to make sure CX_ICON was a valid value and not sending a window message that may interfere with your programs operation.
I once had a similar problem but it was a bug in my code that caused the app to abort (threw an exception which caused all my classes to destruct, removing the icon from the tray). The app didn''t initally have any visible windows so I didn''t realize it was happening. I''ve never tried allowing the app to exit without first removing the icon. If the process ends it''s possible Windows will remove it on its own. Anyway, there seems to be a bit of latency when removing the icon from the tray so it stuck around even after I called Shell_NotifyIcon to remove it, but once I put my cursor over the Icon it dissappeared.
BTW, I''ve only used version 5 of this shell function so if your using version 6 all bets could be off.
You can add formatted source using the following tags:
There are a few more helpfull tags similar to those in the site''s FAQ.
I once had a similar problem but it was a bug in my code that caused the app to abort (threw an exception which caused all my classes to destruct, removing the icon from the tray). The app didn''t initally have any visible windows so I didn''t realize it was happening. I''ve never tried allowing the app to exit without first removing the icon. If the process ends it''s possible Windows will remove it on its own. Anyway, there seems to be a bit of latency when removing the icon from the tray so it stuck around even after I called Shell_NotifyIcon to remove it, but once I put my cursor over the Icon it dissappeared.
BTW, I''ve only used version 5 of this shell function so if your using version 6 all bets could be off.
You can add formatted source using the following tags:
There are a few more helpfull tags similar to those in the site''s FAQ.
thanks. didn''t see the FAQ before. Didn''t work, but I''m trying MSDN for more info. THanks though.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement