Shell_NotifyIcon problem.. Help Techies!!
-
:confused:Dear All, I am developing an application using MFC VC++ Version 6.0 for Windows 2000. I have made my application run as a service. The application starts with an icon in the System tray. On double clicking the icon the application starts (ie. dialog boxes are displayed, some background operations are performed, etc..) The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!! The tray icon then doesnot responds to the mouse events (double click , single click or right click) I know that during loggoff the service keeps on running. And the application is performing its background operations also during loggoff, but the tray icon stops responding. Do I need to refresh the tray icon ???? Or any alternate solution to above problem Please comment! Rohit
-
:confused:Dear All, I am developing an application using MFC VC++ Version 6.0 for Windows 2000. I have made my application run as a service. The application starts with an icon in the System tray. On double clicking the icon the application starts (ie. dialog boxes are displayed, some background operations are performed, etc..) The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!! The tray icon then doesnot responds to the mouse events (double click , single click or right click) I know that during loggoff the service keeps on running. And the application is performing its background operations also during loggoff, but the tray icon stops responding. Do I need to refresh the tray icon ???? Or any alternate solution to above problem Please comment! Rohit
:-D
-
:-D
I presume, your application thread is blocked by the background operations. So use GetMessage( &msg, NULL, 0, 0 ) TranslateMessage(&msg); DispatchMessage(&msg); in your message loop. See msdn for more details. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/getmessage.asp "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
:confused:Dear All, I am developing an application using MFC VC++ Version 6.0 for Windows 2000. I have made my application run as a service. The application starts with an icon in the System tray. On double clicking the icon the application starts (ie. dialog boxes are displayed, some background operations are performed, etc..) The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!! The tray icon then doesnot responds to the mouse events (double click , single click or right click) I know that during loggoff the service keeps on running. And the application is performing its background operations also during loggoff, but the tray icon stops responding. Do I need to refresh the tray icon ???? Or any alternate solution to above problem Please comment! Rohit
There can be several problems, but the most likely is that you dont get the notification about the tray creation. Following is from MSDN: Taskbar Creation Notification With Internet Explorer 4.0 and later, the Shell notifies applications that the taskbar has been created. When the taskbar is created, it registers a message with the TaskbarCreated string and then broadcasts this message to all top-level windows. When your taskbar application receives this message, it should assume that any taskbar icons it added have been removed and add them again. This feature generally applies only to services that are already running when the Shell begins execution. The following example shows a very simplified method for handling this case. So you will need to do this and then handle that message m_nTaskbarCreatedMsg = ::RegisterWindowMessage( "TaskbarCreated" ); And take a look at Chris Maunder excellent class http://www.codeproject.com/shell/systemtray.asp[^] Magnus
-
There can be several problems, but the most likely is that you dont get the notification about the tray creation. Following is from MSDN: Taskbar Creation Notification With Internet Explorer 4.0 and later, the Shell notifies applications that the taskbar has been created. When the taskbar is created, it registers a message with the TaskbarCreated string and then broadcasts this message to all top-level windows. When your taskbar application receives this message, it should assume that any taskbar icons it added have been removed and add them again. This feature generally applies only to services that are already running when the Shell begins execution. The following example shows a very simplified method for handling this case. So you will need to do this and then handle that message m_nTaskbarCreatedMsg = ::RegisterWindowMessage( "TaskbarCreated" ); And take a look at Chris Maunder excellent class http://www.codeproject.com/shell/systemtray.asp[^] Magnus
I dont think the problem is with getting the notification from tray. The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!! On double clicking the icon the application starts This means he got the notification atleast once. Anyway looking at that article can provide him a hint. "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
I dont think the problem is with getting the notification from tray. The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!! On double clicking the icon the application starts This means he got the notification atleast once. Anyway looking at that article can provide him a hint. "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
Dear Jagadessh VN, When i log off and login the 1) Tray icon appears 2) The background processsing starts BUT THE SYSTEM TRAY ICON DOESNOT RESPONDS TO MOUSE CLICK EVENTS. i.e. when i double click or move mouse over the icon, the icon has no response ( i traced my application and it shows no response) So what may be the problem ?? Thanks . Rohit