borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2013 Andrea Tincani
:: Give user ability to interrupt loop

Author  

Mike G

Language  

VB5, VB6

Operating Systems  

Windows 95, 98, NT, 2000, Me, XP
API Declarations
Private Declare Function GetAsyncKeyState Lib "user32.dll" _
                (ByVal vKey As Long) As Integer
                
'//ESCAPE
Const VK_ESCAPE = &H1B
'//Button Click
Const VK_LBUTTON = &H1
Usage

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

:: Navigation

Home

Miscellaneous API Tips

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 14-02-2012 Re: Access 2007 & Win7 by GeoffS
icon 15-01-2008 Looking for A Way to Use A .DLL without Running Regsvr32 by matt_1ca
icon 02-11-2005 Re: how to share databases by yronium
icon 24-06-2005 Re: FlexGrid Printing problem by KIMO
icon 06-04-2005 Right alignment problem with crsytal report 8.5 by abumoosa
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2013 Andrea Tincaniborder