Shell_NotifyIcon with NIM_MODIFY fail
hi guys,
the following code is not mine (from a package i paid for long time ago).
basically i have two ui threads, one is the CWinApp object and the second
is a CWinThread. i need to switch the tray icon handle. the follwoing method
was supposed to do the job but it fails:
Code:
bool CTrayIcon::SetNotificationWnd(CWnd* pWndNotify)
{
m_pNIData->hWnd = pWndNotify->GetSafeHwnd();
m_pNIData->uFlags = 0;
if (!::Shell_NotifyIcon(NIM_MODIFY, m_pNIData)) {
return false; // when calling this function - it will always fall here
}
return true;
}
by looking at this code, can anyone spot something ?
thanks a lot !
Re: Shell_NotifyIcon with NIM_MODIFY fail
Nitification icon uses the hWnd and uID members to identify which icon in the system tray is to be modified. Having said that, you cannot modify the hWnd associated with the notification icon.
If you want to set a different hWnd, you can remove the original notification icon and add a new one using NIM_ADD.
Hope this will help you :)