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.
' ------------------------------------------------------------
' 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