Shell_NotifyIcon locks up thread

Discussion in 'Shell Script' started by ahmd, Jun 23, 2010.

  1. ahmd

    ahmd New Member

    Joined:
    Jun 23, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Can someone explain why the following locks up the main UI thread?


    I have a worker thread that may display a message in a form of a popup balloon. To do so I send a private message from this worker thread into the main UI thread like this:
    Code:
    CWnd* pMainWnd = AfxGetMainWnd();
    pMainWnd->SendMessage(MY_MESSAGE_POPUP_BALLOON, (WPARAM)pBalloonText, nBalloonIcon);
    The main thread processes this message by filling out the NOTIFYICONDATA and calling Shell_NotifyIcon(NIM_MODIFY). Then it returns.

    The code above works on Windows XP. It works under Vista if a desktop is active. But in case the request to show a popup balloon is broadcast while that user's desktop is not active it deadlocks the main thread. (I can tell that when I switch users and the app is not responding, although CPU usage remains at 0%.) It really baffles me..... what's going on?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice