Created
August 16, 2021 09:20
-
-
Save KiRist-code/e9b8f097763d52fa237ff77cd0a2981d to your computer and use it in GitHub Desktop.
How to set SDL frame between wallpaper and wallpaper icon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* if ur enviroment is Windows, import SDL2 and winapi | |
if ur enviroment is Linux or Unix, import SDL2 and X11/Xlib.h | |
*/ | |
#if _WIN32 || _WIN64 | |
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { | |
HWND p = FindWindowEx(hwnd, NULL, "SHELLDLL_DefView", NULL); | |
HWND* ret = (HWND*)lParam; | |
if (p) { | |
// Gets the WorkerW Window after the current one. | |
*ret = FindWindowEx(NULL, hwnd, "WorkerW", NULL); | |
} | |
return true; | |
} | |
HWND get_wallpaper_window(){ | |
HWND progman = FindWindow("ProgMan", NULL); | |
SendMessageTimeout(progman, 0x052C, 0, 0, SMTO_NORMAL, 1000, nullptr); | |
HWND wallpaper_hwnd = nullptr; | |
EnumWindows(EnumWindowsProc, (LPARAM)&wallpaper_hwnd); | |
return wallpaper_hwnd; | |
} | |
#else | |
Window get_wallpaper_window(){ | |
Display* x11d = XOpenDisplay(NULL); | |
Window x11w = RootWindow(x11d, DefaultScreen(x11d)); | |
return x11w; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment