-
I'd like to be able to press the pause key and it would stop the program. the program works on timers, so I could do it by disabling the timers. all I need to know is how to recognize when the user hits the pause key. does anyone know how to do this.
thanks
Otterbine
-
Throw this in the forms keyDown event, and set the forms keypreview prop to true:
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyPause Then
MsgBox "Pause was pressed"
End If
End Sub
-
u can do it like this too
Code:
'General Declarations
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Const VK_PAUSE = &H13
'Timer with interval of 1
Private Sub Timer1_Timer()
If GetAsnycKeyState(VK_PAUSE) <> 0 then
msgbox "Do you stoping code here"
End If
End Sub