Skip to content

Commit

Permalink
Add TransparentFullscreenWindow topmost option
Browse files Browse the repository at this point in the history
  • Loading branch information
dechamps committed Feb 25, 2022
1 parent 55f632b commit 4ed4e18
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 16 additions & 2 deletions TransparentFullscreenWindow/TransparentFullscreenWindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4ed4e18

Please # to comment.