mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
- make Shell Hook Messages really work in Windows
- comments for SHELL32's RegisterShellHook() svn path=/trunk/; revision=14354
This commit is contained in:
parent
0baf2d03b1
commit
03a5f16ed9
10 changed files with 56 additions and 8 deletions
|
@ -736,7 +736,6 @@ MDIMainFrame::MDIMainFrame(HWND hwnd)
|
||||||
extraBtns.idCommand = ID_WEB_WINDOW;
|
extraBtns.idCommand = ID_WEB_WINDOW;
|
||||||
SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
|
SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
|
||||||
|
|
||||||
#define W_VER_NT 0
|
|
||||||
if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
|
if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
|
||||||
// insert NT object namespace button
|
// insert NT object namespace button
|
||||||
extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("NT Obj\0"));
|
extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("NT Obj\0"));
|
||||||
|
|
|
@ -1952,7 +1952,6 @@ void StartMenuHandler::ShowLaunchDialog(HWND hwndOwner)
|
||||||
// Show "Run..." dialog
|
// Show "Run..." dialog
|
||||||
if (RunFileDlg) {
|
if (RunFileDlg) {
|
||||||
#ifndef _ROS_ /* FIXME: our shell32 always expects Ansi strings */
|
#ifndef _ROS_ /* FIXME: our shell32 always expects Ansi strings */
|
||||||
#define W_VER_NT 0
|
|
||||||
if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
|
if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
|
||||||
WCHAR wTitle[40], wText[256];
|
WCHAR wTitle[40], wText[256];
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,16 @@ DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_SetTaskmanWindow(TEXT("user32"), "SetTas
|
||||||
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_RegisterShellHookWindow(TEXT("user32"), "RegisterShellHookWindow");
|
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)> 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()
|
TaskBarEntry::TaskBarEntry()
|
||||||
{
|
{
|
||||||
|
@ -59,13 +69,30 @@ TaskBarMap::~TaskBarMap()
|
||||||
|
|
||||||
TaskBar::TaskBar(HWND hwnd)
|
TaskBar::TaskBar(HWND hwnd)
|
||||||
: super(hwnd),
|
: super(hwnd),
|
||||||
WM_SHELLHOOK(RegisterWindowMessage(TEXT("SHELLHOOK")))
|
WM_SHELLHOOK(RegisterWindowMessage(WINMSG_SHELLHOOK))
|
||||||
{
|
{
|
||||||
_last_btn_width = 0;
|
_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()
|
TaskBar::~TaskBar()
|
||||||
{
|
{
|
||||||
|
// if (g_RegisterShellHook)
|
||||||
|
// (*g_RegisterShellHook)(_hwnd, RSH_UNREGISTER);
|
||||||
|
|
||||||
if (g_DeregisterShellHookWindow)
|
if (g_DeregisterShellHookWindow)
|
||||||
(*g_DeregisterShellHookWindow)(_hwnd);
|
(*g_DeregisterShellHookWindow)(_hwnd);
|
||||||
else
|
else
|
||||||
|
@ -73,6 +100,8 @@ TaskBar::~TaskBar()
|
||||||
|
|
||||||
if (g_SetTaskmanWindow)
|
if (g_SetTaskmanWindow)
|
||||||
(*g_SetTaskmanWindow)(0);
|
(*g_SetTaskmanWindow)(0);
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(_mmMetrics_org), &_mmMetrics_org, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND TaskBar::Create(HWND hwndParent)
|
HWND TaskBar::Create(HWND hwndParent)
|
||||||
|
@ -105,7 +134,7 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs)
|
||||||
|
|
||||||
_next_id = IDC_FIRST_APP;
|
_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)
|
if (g_SetTaskmanWindow)
|
||||||
(*g_SetTaskmanWindow)(_hwnd);
|
(*g_SetTaskmanWindow)(_hwnd);
|
||||||
|
|
||||||
|
@ -118,6 +147,16 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs)
|
||||||
SetTimer(_hwnd, 0, 200, NULL);
|
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();
|
Refresh();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -156,6 +195,10 @@ LRESULT TaskBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
case HSHELL_WINDOWDESTROYED:
|
case HSHELL_WINDOWDESTROYED:
|
||||||
case HSHELL_WINDOWACTIVATED:
|
case HSHELL_WINDOWACTIVATED:
|
||||||
case HSHELL_REDRAW:
|
case HSHELL_REDRAW:
|
||||||
|
#ifdef HSHELL_FLASH
|
||||||
|
case HSHELL_FLASH:
|
||||||
|
case HSHELL_RUDEAPPACTIVATED:
|
||||||
|
#endif
|
||||||
Refresh();
|
Refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -409,6 +452,7 @@ BOOL CALLBACK TaskBar::EnumWndProc(HWND hwnd, LPARAM lparam)
|
||||||
|
|
||||||
entry._fsState = btn.fsState;
|
entry._fsState = btn.fsState;
|
||||||
|
|
||||||
|
#ifdef _ROS_ // now handled by activating the ARW_HIDE flag with SystemParametersInfo(SPI_SETMINIMIZEDMETRICS)
|
||||||
// move minimized windows out of sight
|
// move minimized windows out of sight
|
||||||
if (IsIconic(hwnd)) {
|
if (IsIconic(hwnd)) {
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
@ -418,6 +462,7 @@ BOOL CALLBACK TaskBar::EnumWndProc(HWND hwnd, LPARAM lparam)
|
||||||
if (rect.bottom > 0)
|
if (rect.bottom > 0)
|
||||||
SetWindowPos(hwnd, 0, -32000, -32000, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
|
SetWindowPos(hwnd, 0, -32000, -32000, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -85,6 +85,7 @@ protected:
|
||||||
int _next_id;
|
int _next_id;
|
||||||
WindowHandle _last_foreground_wnd;
|
WindowHandle _last_foreground_wnd;
|
||||||
int _last_btn_width;
|
int _last_btn_width;
|
||||||
|
MINIMIZEDMETRICS _mmMetrics_org;
|
||||||
|
|
||||||
const UINT WM_SHELLHOOK;
|
const UINT WM_SHELLHOOK;
|
||||||
|
|
||||||
|
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
#define _MAX_PATH 260
|
#define _MAX_PATH 260
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define W_VER_NT 0 // constant for HIWORD(GetVersion())>>14
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -984,6 +984,8 @@ enum {TRAYBUTTON_LEFT=0, TRAYBUTTON_RIGHT, TRAYBUTTON_MIDDLE};
|
||||||
|
|
||||||
#define WINMSG_TASKBARCREATED TEXT("TaskbarCreated")
|
#define WINMSG_TASKBARCREATED TEXT("TaskbarCreated")
|
||||||
|
|
||||||
|
#define WINMSG_SHELLHOOK TEXT("SHELLHOOK")
|
||||||
|
|
||||||
|
|
||||||
struct TrayIcon
|
struct TrayIcon
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue