So I am trying to make my own wallpaper engine (for Windows 11) to render OpenGL shaders on my desktop wallpaper. However, I am facing a problem. I found out that I need to get a WorkerW window and set it as the parent of the window where I am rendering the shaders.
The problem is that the code to spawn the WorkerW window just returns 0. I looked in the Win32 API documentation, and that means it failed.
I was wondering — did the new Windows 11 update break that method, or am I doing something wrong?
Here is the relevant part of the code that is failing:
atomic<HWND> workerRef(nullptr);
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) {
if (FindWindowEx(hWnd, NULL, "SHELLDLL_DefView", NULL) == NULL) {
return TRUE;
}
HWND worker = FindWindowEx(NULL, hWnd, "WorkerW", NULL);
if (worker != NULL) {
workerRef = worker;
cout << worker << endl;
return TRUE;
}
return FALSE;
}
HWND getWorkerW() {
HWND progman = FindWindow("Progman", NULL);
if (!progman) {
cout << "failed to get progman";
exit(-1);
}
// it gets here with no problem
SendMessage(progman, 0x052C, (WPARAM)0xD, (LPARAM)0); // returns 0 (fails)
SendMessage(progman, 0x052C, (WPARAM)0xD, (LPARAM)1); // returns 0 (fails)
EnumWindows(EnumWindowsProc, 0);
return workerRef.load(); // returns 0 (fails)
}
This code is just a translation to C++ from the Java code provided as an example on this website (I don’t know Java, so I used AI to translate it — which may have introduced mistakes): https://dynamicwallpaper.readthedocs.io/en/docs/dev/make-wallpaper.html
Any relevant documentation is welcome, and I am open to suggestions if there is a better way of doing this.