I have a Win32 application which adds a taskbar icon on startup.
It is working perfectly, except when Explorer crashes and then restarts, my application keeps on running, but the taskbar icon is gone.
I suspect I'm supposed to handle some event, but which?
Right-click the desktop, click View and select Show desktop icons. To show or hide a particular desktop icon: 1. Right-click the desktop and select Personalize.
IMPORTANT: If you turned On the switch to show a certain icon and that icon is not instantly displayed on your taskbar, the corresponding app is probably not currently running on your computer. Keep in mind that the icons in your Notification area are only shown when their apps are running.
Run System File Checker. If there are corrupted system files on your computer, you may also come across the issue of Windows 10 pinned Taskbar icons missing. In this situation, you need to repair the corrupted system files.
What you are referring to are in fact known as notification icons. It's important to get this terminology right so that we know what you mean. Anyway, I think my guess is accurate.
You need to listen for a window message that is broadcast to all top-level windows when the taskbar is created. This is documented like so:
With Microsoft Internet Explorer 4.0 and later, the Shell notifies applications that the taskbar has been created. When the taskbar is created, it registers a message with the TaskbarCreated string and then broadcasts this message to all top-level windows. When your taskbar application receives this message, it should assume that any taskbar icons it added have been removed and add them again. This feature generally applies only to services that are already running when the Shell launches. The following example shows a very simplified method for handling this case.
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) { static UINT s_uTaskbarRestart; switch(uMessage) { case WM_CREATE: s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); break; default: if(uMessage == s_uTaskbarRestart) AddTaskbarIcons(); break; } return DefWindowProc(hWnd, uMessage, wParam, lParam); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With