Det finns ett API som lyssnar på tangentbords knappar som man kan köra under t.ex en Loop. Vad heter detta API:et och snappar den även upp en mouseup? Du kan ju göra någo sånt här: hm...Lyssna på tangenter under loop
/FrabnsSv: Lyssna på tangenter under loop
Private mCancel As Boolean
Private mMouseDown As Boolean
Private mMouseMove As Boolean
Private mMouseUp As Boolean
Private mKeyAscii As Integer
Private Sub Command1_Click()
Do Until mCancel
If mMouseDown Then
Debug.Print "MouseDown"
mMouseDown = False
End If
If mMouseMove Then
Debug.Print "MouseMove"
mMouseMove = False
End If
If mMouseUp Then
Debug.Print "MouseUp"
mMouseUp = False
End If
If mKeyAscii Then
Debug.Print "KeyPress: " & mKeyAscii
mKeyAscii = 0
End If
DoEvents
Loop
mCancel = False
End Sub
Private Sub Command2_Click()
mCancel = True
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
mKeyAscii = KeyAscii
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mMouseDown = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
mMouseMove = True
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
mMouseUp = True
End Sub
Fast jag skulle föreslå en timer istället för en loop... Sv: Lyssna på tangenter under loop
jag hade tänkt mig något i denna stilen:
do
'gör något
if (Buffer = GetKEy(me.hwnd)) <> 0 then
exit do
end if
loop
/Frans