|
-
Oct 4th, 2000, 06:40 PM
#1
Thread Starter
Junior Member
I`m using this code to wait for a click from the user to pause and continue the program. On some PC's it doesnt work, any idea why ? also how do i detect if its clicked on a particular form ?
Public Sub Wait4Click()
Dim press As Boolean
press = False
Do
DoEvents
If GetAsyncKeyState(1) <> 0 Then press = True
If press = True And (1) = 0 Then Exit Sub
DoEvents
Loop
End Sub
-
Oct 4th, 2000, 07:32 PM
#2
Give it a try...
Code:
Private Sub Wait4Click()
Dim press As Boolean
press = False
Do
If GetAsyncKeyState(vbKeyLButton) Then Debug.Print "LeftClick": press = True
If press = True And (1) = 0 Then Exit Sub
DoEvents
Loop
End Sub
-
Oct 5th, 2000, 03:14 AM
#3
Thread Starter
Junior Member
Woops one of lines have changed but it still doesnt work on other PCs. Do i have to clear the mouse click buffer or something ?
Public Sub Wait4Click()
Dim press As Boolean
press = False
Do
If GetAsyncKeyState(vbKeyLButton) <> 0 Then press = True
If press = True And GetAsyncKeyState(vbKeyLButton) = 0 Then Exit Sub
DoEvents
Loop
End Sub
-
Oct 5th, 2000, 02:20 PM
#4
New Member
You can try these constant "VK_LBUTTON" in replacement of "vbKeyLButton".
Public Const VK_LBUTTON = &H1
Public Const VK_RBUTTON = &H2
Public Sub Wait4Click()
Dim press As Boolean
press = False
Do
If GetAsyncKeyState(VK_LBUTTON ) <> 0 Then press = True
If press = True And GetAsyncKeyState(VK_LBUTTON ) = 0 Then Exit Sub
DoEvents
Loop
End Sub
-
Oct 5th, 2000, 05:53 PM
#5
Thread Starter
Junior Member
still doesnt work ( makes it worse =( )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|