Index: subsys/system/explorer/taskbar/taskbar.cpp =================================================================== --- subsys/system/explorer/taskbar/taskbar.cpp (revision 13872) +++ subsys/system/explorer/taskbar/taskbar.cpp (working copy) @@ -55,12 +55,25 @@ TaskBar::TaskBar(HWND hwnd) : super(hwnd) { + HMODULE Module; _last_btn_width = 0; + + Module = LoadLibraryA("User32.dll"); + if (Module && GetProcAddress(Module, "RegisterShellHookWindow")) { + _HasShellHook = TRUE; + } else { + _HasShellHook = FALSE; + if (Module) + FreeLibrary(Module); + } + LOG (_HasShellHook ? L"Has shell hooks.\n" : L"Does not have shell hooks.\n"); + } TaskBar::~TaskBar() { - KillTimer(_hwnd, 0); + if (!_HasShellHook) + KillTimer(_hwnd, 0); //DeinstallShellHook(); } @@ -99,13 +112,22 @@ Refresh(); - SetTimer(_hwnd, 0, 200, NULL); + if (_HasShellHook) + RegisterShellHookWindow(_hwnd); + else + SetTimer(_hwnd, 0, 200, NULL); return 0; } LRESULT TaskBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) { + static UINT ShellHookNmsg = 0; + + if (!ShellHookNmsg) { + ShellHookNmsg = RegisterWindowMessage(TEXT("SHELLHOOK")); + LOG (FmtString(TEXT("Nmsg == %#x"), ShellHookNmsg)); + } switch(nmsg) { case WM_SIZE: SendMessage(_htoolbar, WM_SIZE, 0, 0); @@ -145,7 +167,19 @@ return (LRESULT)(HWND)_last_foreground_wnd; default: def: - return super::WndProc(nmsg, wparam, lparam); + if (nmsg == RegisterWindowMessage(TEXT("SHELLHOOK"))) { + LOG(FmtString(TEXT("SHELLHOOK %x"), wparam)); + switch (wparam) { + case HSHELL_WINDOWCREATED: + case HSHELL_WINDOWDESTROYED: + case HSHELL_WINDOWACTIVATED: + case HSHELL_REDRAW: + Refresh(); + break; + } + } else { + return super::WndProc(nmsg, wparam, lparam); + } } return 0; Index: subsys/system/explorer/taskbar/taskbar.h =================================================================== --- subsys/system/explorer/taskbar/taskbar.h (revision 13872) +++ subsys/system/explorer/taskbar/taskbar.h (working copy) @@ -85,6 +85,7 @@ int _next_id; WindowHandle _last_foreground_wnd; int _last_btn_width; + BOOL _HasShellHook; LRESULT Init(LPCREATESTRUCT pcs); LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); Index: subsys/system/explorer/Makefile =================================================================== --- subsys/system/explorer/Makefile (revision 13872) +++ subsys/system/explorer/Makefile (working copy) @@ -26,7 +26,7 @@ TARGET_SDKLIBS := \ gdi32.a comctl32.a ole32.a oleaut32.a shell32.a expat.a \ - notifyhook.a ws2_32.a msimg32.a + notifyhook.a ws2_32.a msimg32.a user32.a TARGET_GCCLIBS := stdc++ uuid