close AutoHotkey's main window programmatically Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 5287
Joined: 19 Dec 2016, 01:58
Location: UK

close AutoHotkey's main window programmatically  Topic is solved

19 Aug 2018, 17:11

- AutoHotkey's main window is the one you get by right-clicking the tray icon and clicking Open.
- This closes the process rather than the window.
WinClose, A
- This closes the window.
ControlSend,, {Esc}, A
- I wondered if there was a cleaner way to close the window. Thanks.

- [EDIT:] This works to close the window (without closing the process).
PostMessage, 0x112, 0xF060,,, A ;WM_SYSCOMMAND := 0x112 ;SC_CLOSE := 0xF060
- It is mentioned on the WinClose documentation page.
- While WinRestore/WinMove/WinMinimize/WinMaximize appear to work similarly to the items in a window's alt+space menu. WinClose is an exception.

- In order of forcefulness: WM_SYSCOMMAND+SC_CLOSE, WM_CLOSE, TerminateProcess.
- WinClose uses WM_CLOSE. WinKill uses WM_CLOSE and TerminateProcess.

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Mipha, Scr1pter and 121 guests