Jump to content

Search the Community

Showing results for tags 'longish sleep'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello AutoIt fans, could anyone help me to get back on track please? So I managed to interrupt my function by pressing "Func two" button. But how can I terminate fuction by pressing "X" in GUI ? How can I assign "X" button to "Func two" if that's possible. Regards Ruslanas402 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $fInterrupt = 0 $hGUI = GUICreate("Test", 500, 500) $hButton_1 = GUICtrlCreateButton("Func One", 10, 10, 80, 30) $hButton_2 = GUICtrlCreateButton("Func Two", 10, 50, 80, 30) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0x0000FFFF) = $hButton_2 Then $fInterrupt = 1 Return $GUI_RUNDEFMSG EndFunc While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_1 _Func_1() Case $hButton_2 Exit EndSwitch WEnd Func _Func_1() $fInterrupt = 0 For $i = 1 To 10 ConsoleWrite("-Func 1 Running" & @CRLF) If _Interrupt_Sleep(5000) Then Switch $fInterrupt Case 1 ConsoleWrite("!Func 1 interrrupted" & @CRLF) EndSwitch Return EndIf Next ConsoleWrite(">Func 1 Ended" & @CRLF) EndFunc Func _Interrupt_Sleep($iDelay) Local $iBegin = TimerInit() Do Sleep(10) If $fInterrupt Then Return True EndIf Until TimerDiff($iBegin) > $iDelay Return False EndFunc
×
×
  • Create New...