-
October 21st, 2010, 02:13 PM
#1
Shell_NotifyIcon with NIF_INFO
I made this new thread as I have now with my new code. This time its much simpler and smaller but the Balloon is still not working.
Code:
void CTrayIcon::SetTrayIcon (HWND hWnd)
{
vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&vi);
if (vi.dwMajorVersion >= 6) {
nid.cbSize = sizeof(nid);
nid.uVersion = NOTIFYICON_VERSION_4;
}
else if (vi.dwMajorVersion >= 5) {
nid.cbSize = NOTIFYICONDATA_V2_SIZE;
nid.uVersion = NOTIFYICON_VERSION;
}
Shell_NotifyIcon (NIM_SETVERSION, &nid);
nid.hWnd = hWnd;
nid.uID = 0;
nid.uCallbackMessage = NIF_MSG;
nid.hIcon = ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_GBICO));
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
wcscpy_s(nid.szTip, sizeof(nid.szTip), L"myAppName");
Shell_NotifyIcon (NIM_ADD, &nid);
}
void CTrayIcon::ShowBalloon (LPCTSTR szInfo)
{
nid.uFlags = NIF_INFO;
nid.dwInfoFlags = NIIF_NONE;
wcscpy_s(nid.szInfo, sizeof(nid.szInfo), szInfo);
wcscpy_s(nid.szInfoTitle, sizeof(nid.szInfoTitle), L"myAppName");
Shell_NotifyIcon(NIM_MODIFY, &nid);
}
Last edited by hypheni; November 7th, 2010 at 07:47 AM.
-
October 21st, 2010, 03:05 PM
#2
Re: Shell_NotifyIcon with NIF_INFO
Originally Posted by hypheni
I made this new thread as I have now with my new code. This time its much simpler and smaller but the Balloon is still not working.
Code:
void CGBDialog::ShowBalloon (LPCTSTR szInfo)
{
nid.uFlags = NIF_INFO;
wcscpy_s(nid.szInfo, sizeof(nid.szInfo), szInfo);
nid.uTimeout = 6000;
Shell_NotifyIcon(NIM_MODIFY, &nid);
}
ShowBalloon (L"Balloon Tip shown"); //Not working.
Wouldn't you like to change this red line to
Code:
nid.uFlags |= NIF_INFO;
Victor Nijegorodov
-
October 21st, 2010, 03:10 PM
#3
Re: Shell_NotifyIcon with NIF_INFO
-
October 21st, 2010, 03:17 PM
#4
Re: Shell_NotifyIcon with NIF_INFO
Victor Nijegorodov
-
October 21st, 2010, 04:01 PM
#5
Re: Shell_NotifyIcon with NIF_INFO
I cant understand whats wrong in my code
-
October 21st, 2010, 04:30 PM
#6
Re: Shell_NotifyIcon with NIF_INFO
in what system (2000, XP, Vista, ...) do you have this problem?
Did you read about NOTIFYICONDATA Structure?
Victor Nijegorodov
-
October 22nd, 2010, 12:07 AM
#7
Re: Shell_NotifyIcon with NIF_INFO
-
November 7th, 2010, 07:44 AM
#8
Re: Shell_NotifyIcon with NIF_INFO
Im digging up this old thread as this is related to TrayIcon again with same code.
When Im building a Debug version of my application im getting a NIIF_ERROR icon in the Balloon tip though I have set value NIIF_NONE to dwInfoFlags.
ie:
nid.dwInfoFlags = NIIF_NONE;
but if I build a release version its fine.
-
November 7th, 2010, 07:52 AM
#9
Re: Shell_NotifyIcon with NIF_INFO
Originally Posted by hypheni
Im digging up this old thread as this is related to TrayIcon again with same code.
When Im building a Debug version of my application im getting a NIIF_ERROR icon in the Balloon tip though I have set value NIIF_NONE to dwInfoFlags.
ie:
nid.dwInfoFlags = NIIF_NONE;
Either the code is NOT the same as you posted or there is not such a line there.
Please, post your actual code .
Victor Nijegorodov
-
November 7th, 2010, 07:53 AM
#10
Re: Shell_NotifyIcon with NIF_INFO
I have updated the code with my actual one.. please check my 1st post
-
November 8th, 2010, 10:36 AM
#11
Re: Shell_NotifyIcon with NIF_INFO
-
November 8th, 2010, 11:36 AM
#12
Re: Shell_NotifyIcon with NIF_INFO
This question was asked and answered about a week ago. Search this forum for "Shell_NotifyIcon".
-
November 8th, 2010, 11:39 AM
#13
Re: Shell_NotifyIcon with NIF_INFO
No, that thread was about creating Tray icon with balloon, and this problem is regarding balloon icon ie: nid.dwInfoFlags = NIIF_NONE in debug build.
Please have a look on my 5th post..
Im digging up this old thread as this is related to TrayIcon again with same code.
When Im building a Debug version of my application im getting a NIIF_ERROR icon in the Balloon tip though I have set value NIIF_NONE to dwInfoFlags.
ie:
nid.dwInfoFlags = NIIF_NONE;
but if I build a release version its fine.
-
November 8th, 2010, 12:22 PM
#14
Re: Shell_NotifyIcon with NIF_INFO
Originally Posted by hypheni
No, that thread was about creating Tray icon with balloon, and this problem is regarding balloon icon ie: nid.dwInfoFlags = NIIF_NONE in debug build.
Please have a look on my 5th post..
Okay. Start with the code and project and ONLY change dwInfoFlags param to NIIF_NONE.
Change no other code in the sample and see how it behaves.
If it works as expected, compare the differences between the sample code and your code.
-
November 8th, 2010, 12:58 PM
#15
Re: Shell_NotifyIcon with NIF_INFO
Okay. Start with the code and project and ONLY change dwInfoFlags param to NIIF_NONE.
Change no other code in the sample and see how it behaves.
Sample code?. Are you talking about trying with my code in a new project ?.
I tried that also, but same. In debug build the balloon shows a error icon while in release build its showing me correct icon what Im setting.
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
|