Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

GhostWindow

GhostWindow — a Windows utility that hides any window from screen capture (OBS, Zoom, Discord, etc.), removes it from the taskbar and Alt+Tab, and keeps it on top of other windows.

Works by injecting a DLL into the target process and using SetWindowDisplayAffinity (Windows 10 2004+).


Features

  • Hide a window from screen capture (OBS, Zoom, Discord, Teams, etc.)
  • Remove from taskbar and Alt+Tab
  • Keep on top of other windows
  • Hotkeys — show/hide GhostWindow, pin/unpin target, bring to front
  • Pick mode with countdown timer to select a window under the cursor
  • Watchdog — automatically re-hides if the target process resets window styles
  • Cursor lock — forces the default arrow cursor on hidden windows (prevents custom cursors from appearing)
  • Restore windows individually or all at once on exit
  • The injected DLL remains loaded until the target process exits, to avoid unloading code that may still be referenced by window hooks or callbacks.

Requirements

  • Windows 10 2004+ or Windows 11
  • Python 3.10+
  • PySide6
  • Administrator rights (for injecting into elevated or other-user processes)

Installation

git clone https://github.com/yourusername/GhostWindow.git
cd GhostWindow
pip install PySide6

Building GhostWindow.dll

The DLL is already built and included in the repository. To rebuild:

Visual Studio (MSVC)

:: x64 Native Tools Command Prompt for VS
cl /nologo /LD /O2 /EHsc /W4 GhostWindow.cpp /Fe:GhostWindow.dll /link /DEF:GhostWindow.def

MinGW-w64

g++ -O2 -shared -o GhostWindow.dll GhostWindow.cpp GhostWindow.def -luser32 -static

Usage

Running

:: Run as administrator (recommended)
python ghostwindow.py

Hiding a window

  1. Click "Pick a window" — a 5-second countdown appears
  2. Point your cursor at the target window during the countdown
  3. After selection, click "Hide"
  4. The window disappears from the taskbar, screen capture, and Alt+Tab

Showing a window again

  • Select it in the "HIDDEN WINDOWS" list and click "Show" or "Restore"
  • Or click "Restore" in the bottom bar to restore all windows

Hotkeys

Hotkey Action
Ctrl+Shift+F3 Show/hide the GhostWindow window
Ctrl+Shift+F4 Pin/unpin the selected window (toggle always-on-top)
Ctrl+Shift+F5 Bring the selected window to front
  • During pick mode, Ctrl+Shift+F3 cancels the selection

Buttons

Button Action
Pick a window Select a window under the cursor
Hide GhostWindow Hide GhostWindow itself
Hide Hide the selected window
Show Show the selected window
Bring to front Activate the selected window
Refresh Refresh the hidden windows list
Restore Restore the selected window (un-hide)
Forget Remove from the list (window stays hidden)
Quit Exit, restoring all windows

Project Structure

GhostWindow/
├── ghostwindow.py      — entry point: app setup, hotkeys, admin check
├── constants.py        — tunables, paths, hotkey labels
├── strings.py          — all user-facing text
├── applog.py           — rotating file logging
├── tasks.py            — TaskRunner (QThreadPool, per-key de-duplication)
├── hotkey.py           — global hotkey manager + native event filter
├── core/               — Win32 and domain logic (no Qt widgets)
│   ├── winapi.py       — the only place with ctypes signatures and constants
│   ├── errors.py       — typed errors and Win32 hints
│   ├── procs.py        — Process: alive, image name, module base
│   ├── windows.py      — Window: queries, stealth styling, enumeration
│   ├── injector.py     — DLL injection, remote calls, detach
│   ├── stealth.py      — StealthService: hide/show/pin/detach
│   ├── models.py       — WindowEntry, WindowState, EntryStore
│   ├── probe.py        — WindowProbe: background state snapshot
│   └── system.py       — console hiding, admin check
├── ui/                 — Qt widgets
│   ├── main_window.py  — main view/controller
│   ├── table_model.py  — QAbstractTableModel for the hidden list
│   ├── titlebar.py     — frameless title bar
│   ├── picker.py       — picker overlay for window selection
│   ├── cursor_lock.py  — in-process cursor lock (forces arrow cursor)
│   └── style.qss       — dark theme
├── GhostWindow.cpp     — DLL source
├── GhostWindow.def     — DLL exports
└── GhostWindow.dll     — built DLL

The core package contains no Qt GUI code, so the WinAPI/domain logic can be tested or reused without starting an event loop. MainWindow only handles widgets, user intents and the entry store; blocking work runs through TaskRunner on a background thread pool.


How It Works

  1. Injection — LoadLibraryW via CreateRemoteThread with the DLL path
  2. StealthHide — the DLL calls:
    • SetWindowDisplayAffinity(hwnd, WDA_EXCLUDEFROMCAPTURE) — exclude from capture
    • WS_EX_TOOLWINDOW — remove from taskbar
    • HWND_TOPMOST — keep on top
  3. StealthShow — restore the original state (styles are saved in window properties)
  4. Cursor Lock — ui/cursor_lock.py hooks WM_SETCURSOR and mouse messages on the target window and all its children, forcing the default arrow cursor. A watchdog timer (~30 ms) re-applies the cursor if Qt or the target app changes it programmatically.

Logs and troubleshooting

Runtime logs are written to ghost_debug.log next to the script (rotated at 1 MB, 3 backups). For verbose output:

set GHOSTWINDOW_DEBUG=1
python ghostwindow.py

Common issues:

  • Injection fails / access denied — restart GhostWindow as administrator. A 32-bit DLL cannot be injected into a 64-bit process, and vice versa. Windows forgotten from the list are not restored automatically. If GhostWindow crashes, restart the affected application to reset its state.
  • Hotkey does not work — another application already owns it; close that application or change the hotkey in constants.py.
  • "GhostWindow.dll not found" — build the DLL or place it next to ghostwindow.py.
  • Window is not hidden — UWP/Store apps and some anti-cheat protected processes reject SetWindowDisplayAffinity or DLL injection.

Known Limitations

  • Some anti-cheats may block DLL injection
  • UWP/Store apps may not support SetWindowDisplayAffinity
  • Administrator rights are required to inject into elevated processes

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages