Skip to content

Instantly share code, notes, and snippets.

@dufferzafar
Created September 10, 2013 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dufferzafar/6510152 to your computer and use it in GitHub Desktop.
Save dufferzafar/6510152 to your computer and use it in GitHub Desktop.
Disable Windows 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