Skip to content

Instantly share code, notes, and snippets.

@tepiloxtl
Created May 13, 2025 01:23
Show Gist options
  • Select an option

  • Save tepiloxtl/07314e131aec8a9bedbe8b3bc803e04d to your computer and use it in GitHub Desktop.

Select an option

Save tepiloxtl/07314e131aec8a9bedbe8b3bc803e04d to your computer and use it in GitHub Desktop.
Generate a window with your own title, icon and some customization, for stream overlays
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, force
;This is for AHK v1.1 ONLY
;This script opens a window with option to name it, change icon, active buttons or hide everything on titlebar
;The idea is to run it in Windows XP virtual machine, create a window you want, make a screenshot
;Cut the inside and you should have a cool window decoration ie. for your stream overlay for OBS?
;Also if you use No Icon/Buttons and empty name, you can grab screenshot of completely blank window
;For extraction of assets if you want to make a window frame generator outside of VM
;I don't think you can easily hide just icon without hiding buttons as well?? Maybe just set it to blank??
;Default icon store: C:\Windows\system32\SHELL32.dll
;Icons 50-53 are "blank", but they still cause window title to move as if theres an icon
Gui Options:New
Gui Options:Add, Text, x24 y24 w120 h23 +0x200, Window Title
Gui Options:Add, Edit, x144 y24 w200 h21 vwindowtitle ;If empty, change to " "
Gui Options:Add, Text, x24 y56 w120 h23 +0x200, Icon location
Gui Options:Add, Edit, x144 y56 w200 h21 vicoloc ;If empty, disable Menu, Tray, Icon
Gui Options:Add, Text, x24 y88 w120 h23 +0x200, Icon ID
Gui Options:Add, Edit, x144 y88 w120 h21 vicoid ;If empty, 0
Gui Options:Add, Text, x24 y136 w120 h23 +0x200, Window width
Gui Options:Add, Edit, x144 y136 w120 h21 vwindoww, 400
Gui Options:Add, Text, x24 y168 w120 h23 +0x200, Window height
Gui Options:Add, Edit, x144 y168 w120 h21 vwindowh, 300
Gui Options:Add, CheckBox, x24 y208 w120 h23 vsysmenu, No Icon/Buttons ;-SysMenu
Gui Options:Add, CheckBox, x24 y232 w120 h23 vminimize Checked, Minimize button ;+/-0x20000
Gui Options:Add, CheckBox, x24 y256 w120 h23 vmaximize Checked, Maximize button ;+/-0x10000
Gui Options:Add, CheckBox, x24 y280 w120 h23 vclose Checked, Close button ;DisableCloseButton()
Gui Options:Add, CheckBox, x24 y304 w156 h23 vopenmax, Open window maximized ;WinMaximize, A
Gui Options:Add, Button, x24 y350 w80 h23 gbok, &OK
Gui Options:Show, w400 h400, Tepiloxtl's Window Generator
Return
bok:
{
options := ""
Gui Options:Submit, NoHide
if (windowtitle = "")
{
windowtitle := " "
}
if (icoloc != "")
{
if (icoid = "")
{
icoid := 0
}
Menu, Tray, Icon , %icoloc%, %icoid%
}
if (sysmenu = 1)
{
options := options . "-SysMenu "
}
if (minimize = 1)
{
options := options . "+0x20000 "
} else {
options := options . "-0x20000 "
}
if (maximize = 1)
{
options := options . "+0x10000 "
} else {
options := options . "-0x10000 "
}
Gui, Gen:New, %options%
Gui, Gen:Show, w%windoww% h%windowh%, %windowtitle%
if (close = 0)
{
DisableCloseButton()
}
if (openmax = 1)
{
WinMaximize, A
}
Return
}
;Disables the X close button
DisableCloseButton(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-1,"Uint","0x400")
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-2,"Uint","0x400")
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment