Sign in to follow this  
Followers 0
Valik

No icon after crash

4 posts in this topic

Jon, are you aware that the icon doesn't come back after explorer crashes? It's not that big of a deal, but it's simple to fix so I thought it worth mentioning.

Share this post


Link to post
Share on other sites



Shell32.dll version 4.70 or later send a registered message called "TaskbarCreated" when the taskbar is created (Good time to do it, eh?). That's also the first version of Shell32.dll that automatically restarts explorer on crash.

Make a call to RegisterWindowMessage("TaskbarCreated") to retrieve the ID of that message, then in WndProc do an if (msg == TaskbarCreatedID) and add the icon back if it's detected (I put it in the default section of the case structure since it can't be a label).

I don't think this works for all versions of Windows, but I also didn't see any information on how to restore icons on older versions of Shell32.dll so it may not even be possible on those.

If you need a better example or more information, just google "TaskbarCreated message", plenty of information on it it seems.

Share this post


Link to post
Share on other sites

Here's a trimmed down example of a DlgProc I use which demonstrates how to use it:

BOOL DialogProcHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    UINT TaskbarCreated = RegisterWindowMessage("TaskbarCreated");
    PAINTSTRUCT ps;
    HDC  hDC;
    switch (uMsg) 
    {

...

    default:
  if (uMsg == TaskbarCreated)   // Handles explorer crashes
     {
    ShowTrayIcon(false);  // Might not be necessary but it probably doesn't hurt
    ShowTrayIcon(true);
     }
  break;
    }
    return false;
}   // DialogProcHandler()

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0