Edited text of question.
Main Topics
Browse All Topics I need to identify every time the user clicks the mouse. My VB app is running in background, under WINNT4 as a kind of daemon. I'm not interested in diferentiating what kind of click it is (right/left click, double-click, etc).
I'm using VB5, but VB6 will do too.
Any ideas?
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Dear Maquiavelo,
you can use the Doevents,
I use it for checking whether some key has been pressed while a process is going on. For example :
dim flag as Boolean
dim i as Integer
flag=true
while flag
i = i + 1
DoEvents
wend
***** This program will detect keypress when control has entered while loop.As you can see that while loop is an infinite loop.
hope this helps you.
regards
5star
Thanks Vindevogel: where can I get those tools for free? I've been reading Dan Appleman's book (WINAPI32 Guide or something like that), and the book has a demo version of the controls; but I have to distribute the project because it is a university exam.
And I don't know if it would work, because I'd have to check every window open in the system. Do U think this would be fast enough?
This is Simple solution :
1 - Put a Timer Control as Timer1 into your form and set the Interval property to 300;
2 - Paste the next code into your form declarations :
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Dim NumClicks As Long 'Number of Clicks
3 - Paste the timer code :
Private Sub Timer1_Timer()
Dim Lbutton As Integer
Dim Mbutton As Integer
Dim Rbutton As Integer
Lbutton = GetAsyncKeyState(1&)
Mbutton = GetAsyncKeyState(4&)
Rbutton = GetAsyncKeyState(2&)
If Lbutton Or Mbutton Or Rbutton Then
If Lbutton <> -32768 And Mbutton <> -32768 And Rbutton <> -32768 Then
NumClicks = NumClicks + 1
End If
End If
End Sub
4 - Turn the timer enable and enjoy !
Business Accounts
Answer for Membership
by: MaquiaveloPosted on 1999-05-04 at 20:03:16ID: 1509092
Edited text of question.