Last active
August 4, 2023 09:51
-
-
Save Aetopia/b53e5b039bd2882208ba87de8b1f8083 to your computer and use it in GitHub Desktop.
VOID MarkFullscreenWindow(HWND hWnd, BOOL fFullscreen) Function.
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
// Marks a window as fullscreen. | |
VOID MarkFullscreenWindow(HWND hWnd, BOOL fFullscreen) | |
{ | |
// Source: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist2-markfullscreenwindow | |
ITaskbarList2 *pTaskbarList2 = NULL; | |
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE | COINIT_SPEED_OVER_MEMORY); | |
CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList2, (LPVOID *)&pTaskbarList2); | |
if (fFullscreen) | |
SetPropW(hWnd, L"NonRudeHWND", (HANDLE)FALSE); | |
else | |
SetPropW(hWnd, L"NonRudeHWND", (HANDLE)TRUE); | |
pTaskbarList2->lpVtbl->MarkFullscreenWindow(pTaskbarList2, hWnd, fFullscreen); | |
pTaskbarList2->lpVtbl->Release(pTaskbarList2); | |
CoUninitialize(); | |
pTaskbarList2 = NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment