Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Tray icon not recreated after Explorer restart #78

Open
ttencate opened this Issue Mar 13, 2011 · 1 comment

Comments

Projects
None yet
1 participant
Owner

ttencate commented Mar 13, 2011

Converted from SourceForge issue 2887983, submitted by ttencate

Copying from http://syedgakbar.wordpress.com/2008/07/14/restore-notification-area-icon-after-explorer-crash/

"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?"

Owner

ttencate commented Mar 13, 2011

Submitted by ttencate

Shell_NotifyIcon may give ERROR_TIMEOUT sometimes. http://msdn.microsoft.com/en-us/library/bb762159%28VS.85%29.aspx This possibly happens during Explorer startup. Responding to WM_TASKBARCREATED and not displaying the ERROR_TIMEOUT might also resolve that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment