Skip to content

Instantly share code, notes, and snippets.

@Jaid
Created January 10, 2026 01:17
Show Gist options
  • Select an option

  • Save Jaid/df262b2ca78564a8b309790aed91a5fd to your computer and use it in GitHub Desktop.

Select an option

Save Jaid/df262b2ca78564a8b309790aed91a5fd to your computer and use it in GitHub Desktop.
Windhawk mod: Remove Windows 11 Window Border
// ==WindhawkMod==
// @id remove-window-border
// @name Remove Windows 11 Window Border
// @description Hides the 1-pixel border from all windows without changing dimensions or layout.
// @version 0.1.0
// @author Jaid
// @github https://github.com/jaid
// @include *
// @compilerOptions -ldwmapi
// ==/WindhawkMod==
#include <windows.h>
#include <dwmapi.h>
#ifndef DWMWA_BORDER_COLOR
#define DWMWA_BORDER_COLOR 34
#endif
#ifndef DWMWA_COLOR_NONE
#define DWMWA_COLOR_NONE 0xFFFFFFFE
#endif
void ApplyNoBorder(HWND hWnd) {
if (!IsWindow(hWnd)) {
return;
}
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
if (style & WS_CHILD) {
return;
}
COLORREF color = DWMWA_COLOR_NONE;
HRESULT hr = DwmSetWindowAttribute(hWnd, DWMWA_BORDER_COLOR, &color, sizeof(color));
}
using CreateWindowExW_t = decltype(&CreateWindowExW);
CreateWindowExW_t pOriginalCreateWindowExW;
HWND WINAPI CreateWindowExW_Hook(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) {
HWND hWnd = pOriginalCreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
if (hWnd && !(dwStyle & WS_CHILD)) {
ApplyNoBorder(hWnd);
}
return hWnd;
}
BOOL CALLBACK InitEnumWindowsProc(HWND hWnd, LPARAM lParam) {
DWORD pid = 0;
GetWindowThreadProcessId(hWnd, &pid);
if (pid == GetCurrentProcessId()) {
ApplyNoBorder(hWnd);
}
return TRUE;
}
BOOL Wh_ModInit() {
Wh_SetFunctionHook((void*) CreateWindowExW, (void*) CreateWindowExW_Hook, (void**) &pOriginalCreateWindowExW);
EnumWindows(InitEnumWindowsProc, 0);
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment