- make Shell Hook Messages really work in Windows - comments for SHELL32's RegisterShellHook() Modified: trunk/reactos/subsys/system/explorer/desktop/desktop.cpp Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.h Modified: trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp Modified: trunk/reactos/subsys/system/explorer/utility/utility.cpp Modified: trunk/reactos/subsys/system/explorer/utility/utility.h Modified: trunk/reactos/subsys/system/explorer/utility/window.cpp Modified: trunk/reactos/subsys/system/explorer/utility/window.h _____
Modified: trunk/reactos/subsys/system/explorer/desktop/desktop.cpp --- trunk/reactos/subsys/system/explorer/desktop/desktop.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/desktop/desktop.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -436,7 +436,7 @@
case WM_DESTROY:
///@todo use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state - + if (SetShellWindow) SetShellWindow(0); break; _____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp --- trunk/reactos/subsys/system/explorer/shell/mainframe.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/shell/mainframe.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -736,7 +736,6 @@
extraBtns.idCommand = ID_WEB_WINDOW; SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
-#define W_VER_NT 0 if ((HIWORD(GetVersion())>>14) == W_VER_NT) { // insert NT object namespace button extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("NT Obj\0")); _____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp --- trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -1952,7 +1952,6 @@
// Show "Run..." dialog if (RunFileDlg) { #ifndef _ROS_ /* FIXME: our shell32 always expects Ansi strings */ -#define W_VER_NT 0 if ((HIWORD(GetVersion())>>14) == W_VER_NT) { WCHAR wTitle[40], wText[256];
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp --- trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -36,7 +36,17 @@
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_RegisterShellHookWindow(TEXT("user32"), "RegisterShellHookWindow"); DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_DeregisterShellHookWindow(TEXT("user32"), "DeregisterShellHookWindow");
+/* +DynamicFct<BOOL (WINAPI*)(HWND hWnd, DWORD dwType)> g_RegisterShellHook(TEXT("shell32"), (LPCSTR)0xb5);
+ // constants for RegisterShellHook() +#define RSH_UNREGISTER 0 +#define RSH_REGISTER 1 +#define RSH_REGISTER_PROGMAN 2 +#define RSH_REGISTER_TASKMAN 3 +*/ + + TaskBarEntry::TaskBarEntry() { _id = 0; @@ -59,13 +69,30 @@
TaskBar::TaskBar(HWND hwnd) : super(hwnd), - WM_SHELLHOOK(RegisterWindowMessage(TEXT("SHELLHOOK"))) + WM_SHELLHOOK(RegisterWindowMessage(WINMSG_SHELLHOOK)) { _last_btn_width = 0; + + _mmMetrics_org.cbSize = sizeof(MINIMIZEDMETRICS); + + SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(_mmMetrics_org), &_mmMetrics_org, 0); + + // configure the window manager to hide windows when they are minimized + // This is neccessary to enable shell hook messages. + if (!(_mmMetrics_org.iArrange & ARW_HIDE)) { + MINIMIZEDMETRICS _mmMetrics_new = _mmMetrics_org; + + _mmMetrics_new.iArrange |= ARW_HIDE; + + SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, sizeof(_mmMetrics_new), &_mmMetrics_new, 0); + } }
TaskBar::~TaskBar() { +// if (g_RegisterShellHook) +// (*g_RegisterShellHook)(_hwnd, RSH_UNREGISTER); + if (g_DeregisterShellHookWindow) (*g_DeregisterShellHookWindow)(_hwnd); else @@ -73,6 +100,8 @@
if (g_SetTaskmanWindow) (*g_SetTaskmanWindow)(0); + + SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(_mmMetrics_org), &_mmMetrics_org, 0); }
HWND TaskBar::Create(HWND hwndParent) @@ -105,7 +134,7 @@
_next_id = IDC_FIRST_APP;
- // register ourselved as task manager window to make the following call to RegisterShellHookWindow working + // register the taskbar window as task manager window to make the following call to RegisterShellHookWindow working if (g_SetTaskmanWindow) (*g_SetTaskmanWindow)(_hwnd);
@@ -118,6 +147,16 @@ SetTimer(_hwnd, 0, 200, NULL); }
+/* Alternatively we could use the RegisterShellHook() function in SHELL32, but this is not yet implemented in the WINE code. + if (g_RegisterShellHook) { + (*g_RegisterShellHook)(0, RSH_REGISTER); + + if ((HIWORD(GetVersion())>>14) == W_VER_NT) + (*g_RegisterShellHook)(_hwnd, RSH_REGISTER_TASKMAN); + else + (*g_RegisterShellHook)(_hwnd, RSH_REGISTER); + } +*/ Refresh();
return 0; @@ -156,6 +195,10 @@ case HSHELL_WINDOWDESTROYED: case HSHELL_WINDOWACTIVATED: case HSHELL_REDRAW: +#ifdef HSHELL_FLASH + case HSHELL_FLASH: + case HSHELL_RUDEAPPACTIVATED: +#endif Refresh(); break; } @@ -409,6 +452,7 @@
entry._fsState = btn.fsState;
+#ifdef _ROS_ // now handled by activating the ARW_HIDE flag with SystemParametersInfo(SPI_SETMINIMIZEDMETRICS) // move minimized windows out of sight if (IsIconic(hwnd)) { RECT rect; @@ -418,6 +462,7 @@ if (rect.bottom > 0) SetWindowPos(hwnd, 0, -32000, -32000, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); } +#endif }
return TRUE; _____
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.h --- trunk/reactos/subsys/system/explorer/taskbar/taskbar.h 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/taskbar/taskbar.h 2005-03-27 19:57:26 UTC (rev 14354) @@ -85,6 +85,7 @@
int _next_id; WindowHandle _last_foreground_wnd; int _last_btn_width; + MINIMIZEDMETRICS _mmMetrics_org;
const UINT WM_SHELLHOOK;
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp --- trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -1,5 +1,5 @@
/* - * Copyright 2003, 2004 Martin Fuchs + * Copyright 2003, 2004, 2005 Martin Fuchs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public _____
Modified: trunk/reactos/subsys/system/explorer/utility/utility.cpp --- trunk/reactos/subsys/system/explorer/utility/utility.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/utility/utility.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -1,5 +1,5 @@
/* - * Copyright 2003, 2004 Martin Fuchs + * Copyright 2003, 2004, 2005 Martin Fuchs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public _____
Modified: trunk/reactos/subsys/system/explorer/utility/utility.h --- trunk/reactos/subsys/system/explorer/utility/utility.h 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/utility/utility.h 2005-03-27 19:57:26 UTC (rev 14354) @@ -59,7 +59,9 @@
#define _MAX_PATH 260 #endif
+#define W_VER_NT 0 // constant for HIWORD(GetVersion())>>14
+ #ifdef __cplusplus extern "C" { #endif _____
Modified: trunk/reactos/subsys/system/explorer/utility/window.cpp --- trunk/reactos/subsys/system/explorer/utility/window.cpp 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/utility/window.cpp 2005-03-27 19:57:26 UTC (rev 14354) @@ -1,5 +1,5 @@
/* - * Copyright 2003, 2004 Martin Fuchs + * Copyright 2003, 2004, 2005 Martin Fuchs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public _____
Modified: trunk/reactos/subsys/system/explorer/utility/window.h --- trunk/reactos/subsys/system/explorer/utility/window.h 2005-03-27 19:57:20 UTC (rev 14353) +++ trunk/reactos/subsys/system/explorer/utility/window.h 2005-03-27 19:57:26 UTC (rev 14354) @@ -984,7 +984,9 @@
#define WINMSG_TASKBARCREATED TEXT("TaskbarCreated")
+#define WINMSG_SHELLHOOK TEXT("SHELLHOOK")
+ struct TrayIcon { TrayIcon(HWND hparent, UINT id)