Skip to content

Instantly share code, notes, and snippets.

@zimnyaa
Created February 7, 2022 12:44
Show Gist options
  • Save zimnyaa/1101d7c2dc4474c9e022accf6dcc4aad to your computer and use it in GitHub Desktop.
Save zimnyaa/1101d7c2dc4474c9e022accf6dcc4aad to your computer and use it in GitHub Desktop.
Hiding windows in a current process (code snippet from xyrella)
when defined hidewindow:
proc wndenumcallback(windowHandle: HWND, param: LPARAM): WINBOOL {.stdcall.} =
var process_id: DwORD
var wanted = cast[ptr DWORD](param)
GetWindowThreadProcessId(windowHandle, &process_id);
if process_id == wanted[]:
ShowWindow(windowHandle, SW_FORCEMINIMIZE)
return true
proc hidewindow() =
var processID = GetCurrentProcessId();
EnumWindows(wndenumcallback, cast[LPARAM](addr processID))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment