ウインドウ外をクリックでウインドウを閉じるGUI
つうことで作ってみた(非アクティブになったら閉じる訳ではない)

#NoTrayIcon

Gui, New, +HwndMyGuiHwnd, テストタイトル
Gui, Add, Text, x-0 y-0 w130 h30, テストテキスト
Gui, Show, x200 y100 h150 w250
Return

GuiClose:
ExitApp

~LButton::
MouseGetPos, , , Hwnd
if (Hwnd != MyGuiHwnd) {
gosub, GuiClose
}
Return