CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    372

    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 !

  2. #2
    Join Date
    Apr 2003
    Posts
    1,755

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured