mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Tweaked.
This commit is contained in:
parent
4aafa49a28
commit
8fbac4639b
@ -564,81 +564,28 @@ HWND CSystem::GetDefaultShellWindow()
|
||||
}
|
||||
|
||||
/*
|
||||
** GetShellDesktopWindow
|
||||
** GetWorkerW
|
||||
**
|
||||
** Finds the Shell's desktop window or WorkerW window.
|
||||
** If the window is not found, this function returns NULL.
|
||||
**
|
||||
** Note for WorkerW:
|
||||
**
|
||||
** In Earlier Windows / 7 (without Aero):
|
||||
** This function returns a topmost window handle which is visible.
|
||||
**
|
||||
** In Windows 7 (with Aero):
|
||||
** This function returns a window handle which has the "SHELLDLL_DefView".
|
||||
** Finds the WorkerW window.
|
||||
** If the window is not found, returns NULL.
|
||||
**
|
||||
*/
|
||||
HWND CSystem::GetShellDesktopWindow(bool findWorkerW)
|
||||
HWND CSystem::GetWorkerW()
|
||||
{
|
||||
HWND DesktopW = NULL, hwnd;
|
||||
|
||||
HWND ShellW = GetDefaultShellWindow();
|
||||
if (!ShellW) return NULL; // Default Shell (Explorer) not running
|
||||
|
||||
if ((hwnd = FindWindowEx(ShellW, NULL, L"SHELLDLL_DefView", L"")) &&
|
||||
(DesktopW = FindWindowEx(hwnd, NULL, L"SysListView32", NULL))) // In Earlier Windows / 7 (without Aero)
|
||||
{
|
||||
if (findWorkerW)
|
||||
if (FindWindowEx(ShellW, NULL, L"SHELLDLL_DefView", L"") == NULL)
|
||||
{
|
||||
HWND WorkerW = NULL;
|
||||
while (WorkerW = FindWindowEx(NULL, WorkerW, L"WorkerW", L""))
|
||||
{
|
||||
if (IsWindowVisible(WorkerW) && BelongToSameProcess(ShellW, WorkerW))
|
||||
{
|
||||
// Check whether WorkerW covers whole of the screens
|
||||
WINDOWPLACEMENT wp = {sizeof(WINDOWPLACEMENT)};
|
||||
GetWindowPlacement(WorkerW, &wp);
|
||||
|
||||
if (wp.rcNormalPosition.left == c_Monitors.vsL &&
|
||||
wp.rcNormalPosition.top == c_Monitors.vsT &&
|
||||
(wp.rcNormalPosition.right - wp.rcNormalPosition.left) == c_Monitors.vsW &&
|
||||
(wp.rcNormalPosition.bottom - wp.rcNormalPosition.top) == c_Monitors.vsH)
|
||||
if (BelongToSameProcess(ShellW, WorkerW) && FindWindowEx(WorkerW, NULL, L"SHELLDLL_DefView", L""))
|
||||
{
|
||||
return WorkerW;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BelongToSameProcess(ShellW, DesktopW))
|
||||
{
|
||||
return DesktopW;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // In Windows 7 (with Aero)
|
||||
{
|
||||
HWND WorkerW = NULL;
|
||||
while (WorkerW = FindWindowEx(NULL, WorkerW, L"WorkerW", L""))
|
||||
{
|
||||
if (BelongToSameProcess(ShellW, WorkerW))
|
||||
{
|
||||
if ((hwnd = FindWindowEx(WorkerW, NULL, L"SHELLDLL_DefView", L"")) &&
|
||||
(DesktopW = FindWindowEx(hwnd, NULL, L"SysListView32", NULL)))
|
||||
{
|
||||
if (findWorkerW)
|
||||
{
|
||||
return WorkerW;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DesktopW;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -864,7 +811,8 @@ void CALLBACK CSystem::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event,
|
||||
WCHAR className[16];
|
||||
if (GetClassName(hwnd, className, 16) > 0 &&
|
||||
_wcsicmp(className, L"WorkerW") == 0 &&
|
||||
hwnd == GetWorkerW())
|
||||
BelongToSameProcess(GetDefaultShellWindow(), hwnd) &&
|
||||
FindWindowEx(hwnd, NULL, L"SHELLDLL_DefView", L""))
|
||||
{
|
||||
CheckDesktopState(hwnd);
|
||||
}
|
||||
@ -880,8 +828,6 @@ void CALLBACK CSystem::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event,
|
||||
*/
|
||||
LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static int DesktopCompositionCheckCount = 0;
|
||||
|
||||
if (hWnd != c_Window)
|
||||
{
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
@ -66,8 +66,7 @@ public:
|
||||
|
||||
static bool GetShowDesktop() { return c_ShowDesktop; }
|
||||
|
||||
static HWND GetShellDesktopWindow(bool findWorkerW = false);
|
||||
static HWND GetWorkerW() { return GetShellDesktopWindow(true); }
|
||||
static HWND GetWorkerW();
|
||||
|
||||
static HWND GetHelperWindow() { return c_HelperWindow; }
|
||||
static void PrepareHelperWindow(HWND WorkerW);
|
||||
|
Loading…
Reference in New Issue
Block a user