Valik Posted December 12, 2003 Share Posted December 12, 2003 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. Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 12, 2003 Administrators Share Posted December 12, 2003 I didn't know there was an easy fix. Please tell Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted December 12, 2003 Author Share Posted December 12, 2003 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 More sharing options...
Valik Posted December 12, 2003 Author Share Posted December 12, 2003 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now