Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

ahk v2 make window borderless

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Qwenqwq-32b’s answer.
  1. User

    ahk v2 make window borderless

  2. Assistant

    In AutoHotkey v2, to make a window borderless (remove the title bar and borders), you typically modify the window style using the WinSet or DllCall functions.

    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:

    • GetWindowLong with GWL_STYLE (-16) retrieves the current window style.
    • We remove the WS_CAPTION (which includes the title bar and border) and WS_THICKFRAME (resizable border).
    • SetWindowLong applies the new style.
    • SetWindowPos with SWP_FRAMECHANGED forces 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!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.

Identical first prompt