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 !