how to Exitapp when I close the message box clicking on close cross? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
partof
Posts: 95
Joined: 16 Jan 2016, 08:38

how to Exitapp when I close the message box clicking on close cross?

11 Mar 2019, 06:37

Sorry, it's very basic, but I can't fin the answer.
My app exit when I press the ok button with the following code, but not when I close I close it by clicking on the cross:

Code: Select all

Gui,1: +AlwaysOnTop +ToolWindow +HwndMyWinHwnd
Gui, Color, Yellow
Gui, Margin, 50, 50
Gui, Add, Text,  x50 y20, test)
Gui, Add, Button, x50 y50 w100 h18 ,OK
Gui, Show, w200 h100
Return

ButtonOK:
Sleep, 10000
GuiClose:
GuiEscape:
ExitApp
Return
Thanks!
partof
Posts: 95
Joined: 16 Jan 2016, 08:38

Re: how to Exitapp when I close the message box clicking on close cross?

11 Mar 2019, 06:54

My bad! It was actually working, I was runing another file with the same name. I thank you and apologize for wasting your time.

For those interested:

This (last part of the script) will only exitApp if you click on the ok button to close the msgbox:

Code: Select all

ButtonOK:
ExitApp
Return
This will exitApp if you click either on the ok button, or the cross to close:

Code: Select all

ButtonOK:
Sleep, 10000
GuiClose:
GuiEscape:
ExitApp
Return

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, Crayder, Google [Bot], TCO and 228 guests