Akbar’s Weblog

July 14, 2008

Restore Notification Area Icon after Explorer Crash

Filed under: Win32 API, Windows — Tags: , , , — syedgakbar @ 7:05 pm

If you are writing any application which adds an icon to the Taskbar notification area, it’s recommend to handle the “WM_TASKBARCREATED” the message sent by explorer. This message is sent by explorer when it’s creating the taskbar. As after crash explorer doesn’t remember the original notification icons, you should handle this message and then re-register your application notification icon.
 
To capture this message, you must first register it like this:

const static UINT WM_TASKBARCREATED = ::RegisterWindowMessage(__T(“TaskbarCreated”));
 
Once it’s registered, you should handle this in your Windows Callback Procedure to re-add the icon for your application in the notification area. Something like this:
 
// Check if the Taskbar is just being created. This message is broadcast by the Explorer
// when it’s launched (after any crash)
if (message == WM_TASKBARCREATED)
{
    // Add the code to re-add your application in the notification area.
}
 
Simple, but yet effective. What do you think?

2 Comments »

  1. [...] – bookmarked by 3 members originally found by MartinEm on 2008-07-20 Restore Notification Area Icon after Explorer Crash http://syedgakbar.wordpress.com/2008/07/14/restore-notification-area-icon-after-explorer-crash/ – [...]

    Pingback by Bookmarks about Explorer — August 10, 2008 @ 9:16 am

  2. Great trick

    Comment by Oky Firmansyah — March 19, 2009 @ 3:18 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.