gpt-4.1-mini-2025-04-14· OpenAI
LMArena Human Preference 140K
ahk v2 make window borderless
- User
ahk v2 make window borderless
- Assistant
In AutoHotkey v2, to make a window borderless (remove the title bar and borders), you typically modify the window style using the
WinSetorDllCallfunctions.Here’s a simple example script that removes the border and title bar of a window by its title or window ID:
; Example: Make a window borderless by its title windowTitle := "Untitled - Notepad" ; Change this to your target window title ; Get the window ID (HWND) hwnd := WinExist(windowTitle) if !hwnd { MsgBox("Window not found!") ExitApp } ; Constants for window styles WS_BORDER := 0x00800000 WS_DLGFRAME := 0x00400000 WS_CAPTION := WS_BORDER | WS_DLGFRAME WS_THICKFRAME := 0x00040000 ; Get current style style := DllCall("GetWindowLong", "Ptr", hwnd, "Int", -16, "UInt") ; GWL_STYLE = -16 ; Remove the styles that create borders and title bar newStyle := style & ~WS_CAPTION & ~WS_THICKFRAME ; Set the new style DllCall("SetWindowLong", "Ptr", hwnd, "Int", -16, "UInt", newStyle) ; Apply the changes by redrawing the window frame DllCall("SetWindowPos" , "Ptr", hwnd , "Ptr", 0 , "Int", 0, "Int", 0, "Int", 0, "Int", 0 , "UInt", 0x27) ; SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED MsgBox("Window is now borderless.")Explanation:
GetWindowLongwithGWL_STYLE(-16) retrieves the current window style.- We remove the
WS_CAPTION(which includes the title bar and border) andWS_THICKFRAME(resizable border). SetWindowLongapplies the new style.SetWindowPoswithSWP_FRAMECHANGEDforces the window to redraw with the new style.
Notes:
- Replace
"Untitled - Notepad"with the exact title of the window you want to modify. - You can also use
WinExist("ahk_id " hwnd)if you have the HWND. - This method works for most standard windows but may not work on some special windows or those with custom-drawn borders.
If you want me to help you with a script for a specific window or a more dynamic approach, just ask!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.