"Ove Kaaven" ovehk@ping.uio.no wrote:
Since this is probably not the case, perhaps it's better to check for the popup menu class in is_window_managed(), something like
if (GetClassLongA(win->hwndSelf, GCW_ATOM) == POPUPMENU_CLASS_ATOM) return FALSE;
Ah ha! Exactly what I had in mind. After thinking about this, it seemed to me that is_window_managed() should examine the window's class, as well as its style bits, since the class will give a more accurate indication of what kind of window we're dealing with than just the style bits.
Unfortunately this aproach does not work well in all cases, especially in the case of subclassed windows.
Do you have any examples where it might not work... window subclassing is the act of using SetWindowLong to replace the window procedure, which does not change the class atom, as far as I know?
Here is what I did for testing a progress bar control:
GetClassInfo(0, "msctls_progress32", &wnd_class); old_ProgressProc = wnd_class.lpfnWndProc; wnd_class.lpfnWndProc = my_ProgressProc; wnd_class.lpszClassName = "my_progress32"; RegisterClass(&wnd_class);
my_ProgressProc just logs all received messages and then calls an old window procedure: CallWindowProc(old_ProgressProc, hWnd, uMsg, wParam, lParam);