Created
December 24, 2020 15:17
-
-
Save m417z/2ef1273f7998b458c4d4c1002c8f3586 to your computer and use it in GitHub Desktop.
Toggle hide desktop icons, see https://rammichael.com/7-taskbar-tweaker/comment-page-48#comment-12232
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
#include <windows.h> | |
BOOL CALLBACK WndEnumProc(HWND hWnd, LPARAM lParam) | |
{ | |
WCHAR szClassName[16]; | |
if (GetClassName(hWnd, szClassName, _countof(szClassName)) == 0) | |
return TRUE; | |
if (lstrcmp(szClassName, L"WorkerW") != 0) | |
return TRUE; | |
HWND hChildWnd = FindWindowEx(hWnd, NULL, L"SHELLDLL_DefView", NULL); | |
if (!hChildWnd) | |
return TRUE; | |
*(HWND *)lParam = hChildWnd; | |
return FALSE; | |
} | |
int main() | |
{ | |
HWND hParentWnd = FindWindow(L"Progman", NULL); | |
if (!hParentWnd) | |
return 1; | |
HWND hChildWnd = FindWindowEx(hParentWnd, NULL, L"SHELLDLL_DefView", NULL); | |
if (!hChildWnd) | |
{ | |
DWORD dwThreadId = GetWindowThreadProcessId(hParentWnd, NULL); | |
EnumThreadWindows(dwThreadId, WndEnumProc, (LPARAM)&hChildWnd); | |
} | |
if (!hChildWnd) | |
return 2; | |
PostMessage(hChildWnd, WM_COMMAND, 0x7402, 0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Binary: ToggleHideDesktopIcons.exe.