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,78 +564,25 @@ HWND CSystem::GetDefaultShellWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** GetShellDesktopWindow
|
** GetWorkerW
|
||||||
**
|
**
|
||||||
** Finds the Shell's desktop window or WorkerW window.
|
** Finds the WorkerW window.
|
||||||
** If the window is not found, this function returns NULL.
|
** If the window is not found, 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".
|
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
HWND CSystem::GetShellDesktopWindow(bool findWorkerW)
|
HWND CSystem::GetWorkerW()
|
||||||
{
|
{
|
||||||
HWND DesktopW = NULL, hwnd;
|
|
||||||
|
|
||||||
HWND ShellW = GetDefaultShellWindow();
|
HWND ShellW = GetDefaultShellWindow();
|
||||||
if (!ShellW) return NULL; // Default Shell (Explorer) not running
|
if (!ShellW) return NULL; // Default Shell (Explorer) not running
|
||||||
|
|
||||||
if ((hwnd = FindWindowEx(ShellW, NULL, L"SHELLDLL_DefView", L"")) &&
|
if (FindWindowEx(ShellW, NULL, L"SHELLDLL_DefView", L"") == NULL)
|
||||||
(DesktopW = FindWindowEx(hwnd, NULL, L"SysListView32", NULL))) // In Earlier Windows / 7 (without Aero)
|
|
||||||
{
|
|
||||||
if (findWorkerW)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
return WorkerW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (BelongToSameProcess(ShellW, DesktopW))
|
|
||||||
{
|
|
||||||
return DesktopW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // In Windows 7 (with Aero)
|
|
||||||
{
|
{
|
||||||
HWND WorkerW = NULL;
|
HWND WorkerW = NULL;
|
||||||
while (WorkerW = FindWindowEx(NULL, WorkerW, L"WorkerW", L""))
|
while (WorkerW = FindWindowEx(NULL, WorkerW, L"WorkerW", L""))
|
||||||
{
|
{
|
||||||
if (BelongToSameProcess(ShellW, WorkerW))
|
if (BelongToSameProcess(ShellW, WorkerW) && FindWindowEx(WorkerW, NULL, L"SHELLDLL_DefView", L""))
|
||||||
{
|
{
|
||||||
if ((hwnd = FindWindowEx(WorkerW, NULL, L"SHELLDLL_DefView", L"")) &&
|
return WorkerW;
|
||||||
(DesktopW = FindWindowEx(hwnd, NULL, L"SysListView32", NULL)))
|
|
||||||
{
|
|
||||||
if (findWorkerW)
|
|
||||||
{
|
|
||||||
return WorkerW;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return DesktopW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -864,7 +811,8 @@ void CALLBACK CSystem::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event,
|
|||||||
WCHAR className[16];
|
WCHAR className[16];
|
||||||
if (GetClassName(hwnd, className, 16) > 0 &&
|
if (GetClassName(hwnd, className, 16) > 0 &&
|
||||||
_wcsicmp(className, L"WorkerW") == 0 &&
|
_wcsicmp(className, L"WorkerW") == 0 &&
|
||||||
hwnd == GetWorkerW())
|
BelongToSameProcess(GetDefaultShellWindow(), hwnd) &&
|
||||||
|
FindWindowEx(hwnd, NULL, L"SHELLDLL_DefView", L""))
|
||||||
{
|
{
|
||||||
CheckDesktopState(hwnd);
|
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)
|
LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static int DesktopCompositionCheckCount = 0;
|
|
||||||
|
|
||||||
if (hWnd != c_Window)
|
if (hWnd != c_Window)
|
||||||
{
|
{
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||||
|
@ -66,8 +66,7 @@ public:
|
|||||||
|
|
||||||
static bool GetShowDesktop() { return c_ShowDesktop; }
|
static bool GetShowDesktop() { return c_ShowDesktop; }
|
||||||
|
|
||||||
static HWND GetShellDesktopWindow(bool findWorkerW = false);
|
static HWND GetWorkerW();
|
||||||
static HWND GetWorkerW() { return GetShellDesktopWindow(true); }
|
|
||||||
|
|
||||||
static HWND GetHelperWindow() { return c_HelperWindow; }
|
static HWND GetHelperWindow() { return c_HelperWindow; }
|
||||||
static void PrepareHelperWindow(HWND WorkerW);
|
static void PrepareHelperWindow(HWND WorkerW);
|
||||||
|
Loading…
Reference in New Issue
Block a user