diff --git a/README.md b/README.md index 20220c2..2999cd1 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,14 @@ provider details are the same as WindowMonitor. ## TransparentFullscreenWindow -This trivial tool simply displays a window that has the `WS_EX_LAYERED` and -`WS_EX_TRANSPARENT` [extended window styles][]. It also makes the window full -screen by setting its dimensions to be the same as the screen. This emulates -a "sneaky" full screen window such as the GeForce Experience overlay window. +This trivial command line tool simply displays a window that has the +`WS_EX_LAYERED` and `WS_EX_TRANSPARENT` [extended window styles][]. It also +makes the window full screen by setting its dimensions to be the same as the +screen. This emulates a "sneaky" full screen window such as the GeForce +Experience overlay window. + +If you pass the `"topmost"` command line parameter, the full screen window will +also have the `WS_EX_TOPMOST` style, i.e. it will be "always on top". Note that this tool has only been tested in a single-monitor setup. The dimensions of the window might be incorrect on a multi-monitor setup. diff --git a/TransparentFullscreenWindow/TransparentFullscreenWindow.c b/TransparentFullscreenWindow/TransparentFullscreenWindow.c index 68ddd47..98bd962 100644 --- a/TransparentFullscreenWindow/TransparentFullscreenWindow.c +++ b/TransparentFullscreenWindow/TransparentFullscreenWindow.c @@ -19,7 +19,21 @@ static LRESULT CALLBACK TransparentFullscreenWindow_WindowProcedure(HWND hWnd, U return DefWindowProcW(hWnd, uMsg, wParam, lParam); } -int main() { +static void TransparentFullscreenWindow_Usage() { + fwprintf(stderr, L"usage: TransparentFullscreenWindow [topmost]\n"); + exit(EXIT_FAILURE); +} + +int wmain(int argc, const wchar_t* const* const argv, const wchar_t* const* const envp) { + UNREFERENCED_PARAMETER(envp); + + if (argc > 2) TransparentFullscreenWindow_Usage(); + DWORD additionalExtendedStyles = 0; + if (argc == 2) { + if (wcscmp(argv[1], L"topmost") == 0) additionalExtendedStyles |= WS_EX_TOPMOST; + else TransparentFullscreenWindow_Usage(); + } + const HRESULT registerResult = TraceLoggingRegister(WindowInvestigator_traceloggingProvider); if (!SUCCEEDED(registerResult)) { fprintf(stderr, "Unable to register tracing provider [0x%lx]\n", registerResult); @@ -48,7 +62,7 @@ int main() { } const HWND window = CreateWindowExW( - /*dwExtStyle=*/WS_EX_LAYERED | WS_EX_TRANSPARENT, + /*dwExtStyle=*/WS_EX_LAYERED | WS_EX_TRANSPARENT | additionalExtendedStyles, /*lpClassName=*/L"WindowInvestigator_TransparentFullscreenWindow", /*lpWindowName=*/L"WindowInvestigator_TransparentFullscreenWindow", /*dwStyle=*/WS_VISIBLE,