-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackgroundWindowManager.cpp
More file actions
41 lines (34 loc) · 1.09 KB
/
Copy pathBackgroundWindowManager.cpp
File metadata and controls
41 lines (34 loc) · 1.09 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "BackgroundWindowManager.h"
HWND BackgroundWindowManager::s_workerw = nullptr;
BackgroundWindowManager::BackgroundWindowManager()
{
m_progMan = FindWindow("Progman", "Program Manager");
SendMessage(m_progMan, 0x0034, 4, 0);
PDWORD_PTR result = nullptr;
SendMessageTimeout(m_progMan, 0x052C, 0, 0, SMTO_NORMAL, 1000, result);
// We enumerate all Windows, until we find one, that has the
// SHELLDLL_DefView as a child. If we found that window, we take its next
// sibling and assign it to workerw.
EnumWindows(
[](HWND tophandle, LPARAM topparamhandle)
{
HWND p = FindWindowEx(tophandle, nullptr, "SHELLDLL_DefView", nullptr);
if (p != nullptr)
{
// Gets the WorkerW Window after the current one.
s_workerw = FindWindowEx(nullptr, tophandle, "WorkerW", nullptr);
}
return TRUE;
},
0);
}
BackgroundWindowManager::~BackgroundWindowManager()
{
DestroyWindow(s_workerw); // Does this even do anything?
s_workerw = nullptr;
SendMessage(m_progMan, 0x0034, 4, 0);
}
HWND BackgroundWindowManager::GetHandle()
{
return s_workerw;
}