YuChan Posted November 18, 2020 Posted November 18, 2020 Hello, I have this code : #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $TESTExit = GUICreate("EXITTest", 275, 250, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU)) $AltF4 = GUICtrlCreateLabel("Press ALT+F4 to exit", 10, 210) $ContextMenu = GUICtrlCreateContextMenu() $ContextMenuExit = GUICtrlCreateMenuItem("Exit", $ContextMenu) $FileMenu = GUICtrlCreateMenu("&File") $FileExit = GUICtrlCreateMenuItem("Exit", $FileMenu) $Button = GUICtrlCreateButton("Exit", 150, 20, 100, 24) GUISetState(@SW_SHOW, $TESTExit) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button, $FileExit, $ContextMenuExit Exit EndSwitch WEnd Can you tell me please how to make for close a active windows and not program ? THX
quoctoanmobile1996 Posted November 18, 2020 Posted November 18, 2020 Example : #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> $GetTitle = WinList() For $i = 1 To $GetTitle[0][0] If $GetTitle[$i][0] <> '' And BitAND(WinGetState($GetTitle[$i][0]), 2) And BitAND(WinGetState($GetTitle[$i][0]), 8) Then $Msb = MsgBox($MB_YESNO + $MB_ICONWARNING, 'Window is active', @TAB & 'Confirm Closing Process ?' & @CR & _ 'Process ID = ' & WinGetProcess($GetTitle[$i][0]) & @CR & _ 'Title = ' & $GetTitle[$i][0]) If $Msb = $IDYES Then WinClose($GetTitle[$i][0]) EndIf EndIf Next Don't know if it's exactly what you asked
JockoDundee Posted November 18, 2020 Posted November 18, 2020 WinClose("[ACTIVE]") Code hard, but don’t hard code...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now