CFanatic

Go Back   CFanatic > Programming > Shell Scripting


  #1  
Old 06-22-2010, 11:00 PM
Junior Member
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ahmd is on a distinguished road
| More
Thumbs down Shell_NotifyIcon locks up thread

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?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get current thread ID in Native mode? unmeshjoshi Win32 Programming 2 06-01-2010 04:58 AM
Initial thread Unagnanitty Introduce yourself 1 08-29-2009 11:59 AM
Thread Prog in C language (OS independent) kumars C Programming 11 10-03-2008 09:30 AM
Visual Studio hangs during Debugging a thread: PfisterHarald MFC Programming 0 09-13-2006 12:30 PM

 

Follow CFanatic on Twitter
CFanatic Search
Custom Search

Advertisement

Go4Expert's Job Board
Powered by

Go4Expert Newsletter
Enter your Name and Email Address below and Click Subscribe.

Subscriber Counter

Not planning to subscribe yet, browse Go4Expert's Newsletter Archive

All times are GMT -5. The time now is 03:47 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Looking for work in C, C++, C#? Sign up at Elance and search over 30,000 Freelancing jobs today.