-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathutils.cpp
More file actions
26 lines (22 loc) · 746 Bytes
/
utils.cpp
File metadata and controls
26 lines (22 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <utils.h>
HWND _WORKERW = nullptr;
inline BOOL CALLBACK EnumWindowsProc(_In_ HWND tophandle, _In_ LPARAM topparamhandle)
{
HWND defview = FindWindowEx(tophandle, 0, L"SHELLDLL_DefView", nullptr);
if (defview != nullptr)
{
_WORKERW = FindWindowEx(0, tophandle, L"WorkerW", 0);
}
return true;
}
HWND Utils::GetWorkerW(){
int result;
HWND windowHandle = FindWindow(L"Progman", nullptr);
//使用 0x3e8 命令分割出两个 WorkerW
SendMessageTimeout(windowHandle, 0x052c, 0 ,0, SMTO_NORMAL, 0x3e8,(PDWORD_PTR)&result);
//遍历窗体获得窗口句柄
EnumWindows(EnumWindowsProc,(LPARAM)nullptr);
// 显示WorkerW
ShowWindow(_WORKERW,SW_HIDE);
return windowHandle;
}