tinus <o112w8r02(a)sneakemail.com>om>:
Use RegisterShellHookWindow
Modified: trunk/reactos/subsys/system/explorer/Makefile
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
Modified: trunk/reactos/w32api/include/winuser.h
_____
Modified: trunk/reactos/subsys/system/explorer/Makefile
--- trunk/reactos/subsys/system/explorer/Makefile 2005-03-13
23:08:51 UTC (rev 14041)
+++ trunk/reactos/subsys/system/explorer/Makefile 2005-03-13
23:10:25 UTC (rev 14042)
@@ -17,7 +17,7 @@
TARGET_CFLAGS := \
-D__USE_W32API -DWIN32 -D_ROS_ \
-D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -DWINVER=0x0500 \
- -DUNICODE -fexceptions -Wall \
+ -DUNICODE -fexceptions -Wall -g \
-I../../../include/expat
TARGET_CPPFLAGS := $(TARGET_CFLAGS)
@@ -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
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
2005-03-13 23:08:51 UTC (rev 14041)
+++ trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
2005-03-13 23:10:25 UTC (rev 14042)
@@ -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;
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
--- trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
2005-03-13 23:08:51 UTC (rev 14041)
+++ trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
2005-03-13 23:10:25 UTC (rev 14042)
@@ -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);
_____
Modified: trunk/reactos/w32api/include/winuser.h
--- trunk/reactos/w32api/include/winuser.h 2005-03-13 23:08:51 UTC
(rev 14041)
+++ trunk/reactos/w32api/include/winuser.h 2005-03-13 23:10:25 UTC
(rev 14042)
@@ -3708,6 +3708,7 @@
#if (_WIN32_WINNT >= 0x0501)
BOOL WINAPI RegisterRawInputDevices(PCRAWINPUTDEVICE,UINT,UINT);
#endif
+BOOL WINAPI RegisterShellHookWindow(HWND);
UINT WINAPI RegisterWindowMessageA(LPCSTR);
UINT WINAPI RegisterWindowMessageW(LPCWSTR);
BOOL WINAPI ReleaseCapture(void);
Show replies by date