Jump to content

No icon after crash


Valik
 Share

Recommended Posts

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.

Link to comment
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()
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...