Monday, March 31, 2008

How do I fix the problem where tooltips appear under the taskbar?

There is a bug in several versions of Windows that causes notification area tooltips to appear under the taskbar, obscuring them from view. The problem can be reproduced by the following procedure: open the start menu, select All Programs, right click on any program, press Open. This problem is documented in Microsoft's Knowledge Base, MS KB 912650. It seems that Microsoft has not had the time to make a patch to fix this bug yet. Their recommendation is to log off and log back on (terrible solution). You can use the following code as a hack in your programs until a bugfix is released.
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
char class[32];

GetClassName(hwnd, class, sizeof(class)/sizeof(char));
if(strcmp(class, "tooltips_class32") == 0)
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
return TRUE;
Then after showing a notification area tooltip, call
EnumWindows(&EnumWindowsProc, 0);
This code scans through all top-level desktop windows, checks if they are tooltip windows, and sets the tooltips to be always on top.

No comments: