|
-
May 11th, 2006, 09:33 AM
#1
System tray icon of my application disappears, when Windows Explorer crashes.
System tray icon of my application disappears, when Windows Explorer crashes. ( After that I again re creates Windows Explorer. But my system tray icon of my application doesn't reappear.)
Which message will Windows Taskbar generate to restore the system tray icons.?
Can anyone please help me to solve this problem.
-
May 11th, 2006, 09:44 AM
#2
Re: System tray icon of my application disappears, when Windows Explorer crashes.
Following is the code I used. Please check if there are some problems in it.
NOTIFYICONDATA iconData;
iconData.cbSize = sizeof(NOTIFYICONDATA);
iconData.hWnd = this->m_hWnd;
iconData.uID = IDR_MAINFRAME;
iconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP ;
iconData.hIcon = (HICON) LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE (IDI_ICON1), IMAGE_ICON, 16, 16, LR_VGACOLOR);
iconData.uCallbackMessage = WM_NOTIFYICON;
CString str;
str.LoadString(IDS_STR_ICON);
strcpy(iconData.szTip, str);
BOOL ret = Shell_NotifyIcon(NIM_ADD, &iconData);
-
May 11th, 2006, 09:57 AM
#3
Re: System tray icon of my application disappears, when Windows Explorer crashes.
Probably it's not an issue of your application but of the system tray itself, as icons from all other programs disappear as well. Maybe you can add a hook and create your icon when the taskbar is back again?
-
May 11th, 2006, 11:13 AM
#4
Re: System tray icon of my application disappears, when Windows Explorer crashes.
Hah but your why does Windows Explorer crash in the first place?
Try to investigate as to why the Explorer crashs...if it due to some faulty code you wrote (I wonder how!)...then you should correct your code else leave this problem...since it is not your job to take of what happens upon a windows component (say Windows Explorer in this case) crash
-
May 11th, 2006, 12:00 PM
#5
Re: System tray icon of my application disappears, when Windows Explorer crashes.
No needs for any hooks. Windows has a build-in feature to notify you when the notification area is recreated.
First register the following message:
Code:
UINT m_nWMTaskBarCreated = ::RegisterWindowMessage(_T("TaskbarCreated"));
Then in your windowproc you can do something like:
Code:
if (uMsg == m_nWMTaskBarCreated)
{
InstallTrayIcons();
return 0;
}
-
May 12th, 2006, 02:01 AM
#6
Re: System tray icon of my application disappears, when Windows Explorer crashes.
Good one there Marc but could kindly tell me the source of this information. Thanks
-
May 12th, 2006, 07:13 AM
#7
Re: System tray icon of my application disappears, when Windows Explorer crashes.
Thanks a lot Marc for helping me to solve this problem.
This is an excellent solution.
-
May 12th, 2006, 07:28 AM
#8
Re: System tray icon of my application disappears, when Windows Explorer crashes.
Good one there Marc but could kindly tell me the source of this information. Thanks
MSDN has it, http://msdn.microsoft.com/library/en...asp?frame=true
-
May 12th, 2006, 07:32 AM
#9
Re: System tray icon of my application disappears, when Windows Explorer crashes.
A relevant read -
Whenever Internet Explorer 4.0 starts the taskbar, it broadcasts a registered message TaskbarCreated to all top-level parent windows. This is your cue to recreate the icons. If you're using MFC, all you have to do is define a global variable to hold the registered message and implement an ON_REGISTERED_MESSAGE handler for it.
-
May 13th, 2006, 05:09 AM
#10
Re: System tray icon of my application disappears, when Windows Explorer crashes.
 Originally Posted by MrBeans
Good one there Marc  but could kindly tell me the source of this information. Thanks
See the link posted by Krishnaa.
Note that this will only work with Internet Explorer 4.0 and later, but that's almost all versions of Windows.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|