VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Give user ability to interrupt loop.

by Mike G (7 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 10th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Give user ability to interrupt loop.

Rate Give user ability to interrupt loop.



' ------------------------------------------------------------
'  Copyright ©2001 Mike G --> IvbNET.COM
'  All Rights Reserved, http://www.ivbnet.com
'  EMAIL : [email protected]
' ------------------------------------------------------------
'  You are free to use this code within your own applications,
'  but you are forbidden from selling or distributing this
'  source code without prior written consent.
' ------------------------------------------------------------

Private Declare Function GetAsyncKeyState Lib "user32" _
                (ByVal vKey As Long) As Integer
                
                '//ESCAPE
                Const VK_ESCAPE = &H1B
                '//Button Click
                Const VK_LBUTTON = &H1
                
'//Interrupting A Do Loop
'//Give user ability to interrupt loop
Private Sub cmdStart_Click()
   Do
    If GetAsyncKeyState(VK_ESCAPE) < 0 Or _
       GetAsyncKeyState(VK_LBUTTON) < 0 Then
       Debug.Print "-------> EXIT <-------"
       Exit Do
    End If
    Debug.Print "______ LOOPING ___________"
    Loop
End Sub

Download this snippet    Add to My Saved Code

Give user ability to interrupt loop. Comments

No comments have been posted about Give user ability to interrupt loop.. Why not be the first to post a comment about Give user ability to interrupt loop..

Post your comment

Subject:
Message:
0/1000 characters