-
December 21st, 2010, 08:53 AM
#1
Flushing the mouse buffer
I would like to know how you can clear the mouse clicks. Here is my problem.
I use an image as a button with mouse_move, mouse_up and mouse_down events. But what happens is that when I click once, if I click to fast a seconde time, the down effect of the button won't happen because the system taks the other click as a double click instead of a seperate new click.
I would like to know if there is a way I can flush the last click so that the system does not count it as first click in a double click. In that case the button will reply to the mouse down event and not the mouse_dblclick event.
Thanks in advance.
David Richard
-
December 21st, 2010, 12:05 PM
#2
Re: Flushing the mouse buffer
Use a DoEvent() statement, to keep things moving, or use a new thread for the separate process. That's where VB.Net comes in handy.
-
December 21st, 2010, 12:17 PM
#3
Re: Flushing the mouse buffer
I cannot move to VB.NET so I need to work with VB6. All my applications are with VB6. The DoEvent does not work. I really need to flush the last click event of the mouse.
Please do not suggest to move to VB.NET any more. I posted the request here in the VB6 forums because that is what I need. I know VB.NET is better and take's in charge a lot more stuff but I'm used to VB6 and that is the environment I am using.
David Richard
-
December 21st, 2010, 10:38 PM
#4
Re: Flushing the mouse buffer
Then do it the VB6 way. As soon as they click once, DISABLE the click event.
-
December 22nd, 2010, 12:17 AM
#5
Re: Flushing the mouse buffer
You could just place code in the double click event that calls the code ran by the mouse down. Assuming that the mouse down event is not already running when they do this. Seems simple enough.
Always use [code][/code] tags when posting code.
-
December 22nd, 2010, 10:30 AM
#6
Re: Flushing the mouse buffer
I cannot disable the click because the user needs to be able to click several times on the image. And, I cannot also use the DblClick event because there is no control over the mouse button pressed. I really need to flush the mouse buffer.
I tried a lot of stuff and nothing works. I found out a small piece of code but it does not do exactly what I want.
Code:
Private Const PM_REMOVE = &H1
Private Const WM_MOUSEFIRST = &H200
Private Const WM_MOUSELAST = &H209
Type POINT_TYPE
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
message As Long
Wparam As Long
Lparam As Long
time As Long
pt As POINT_TYPE
End Type
Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" _
(lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, _
ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long
Public Sub ClearMouseBuffer(ByVal oFrm As Form)
Dim MOUSE_MSG As Msg
PeekMessage MOUSE_MSG, oFrm.hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE
End Sub
If someone has an idea, this will help me a lot.
Thanks for your comments and time for trying to help me out.
David Richard
-
January 18th, 2012, 10:24 AM
#7
Re: Flushing the mouse buffer
Originally Posted by avidichard
I would like to know how you can clear the mouse clicks. Here is my problem.
I use an image as a button with mouse_move, mouse_up and mouse_down events. But what happens is that when I click once, if I click to fast a seconde time, the down effect of the button won't happen because the system taks the other click as a double click instead of a seperate new click.
I would like to know if there is a way I can flush the last click so that the system does not count it as first click in a double click. In that case the button will reply to the mouse down event and not the mouse_dblclick event.
Thanks in advance.
I've your same problem , have you found a solution ? Many thanks
-
January 18th, 2012, 10:33 AM
#8
Re: Flushing the mouse buffer
No I did not find a solution in that direction. I did do a work arround but it does not relate to this. I had to find another solution much more complexe which does not not implicate mouse clicks.
Sorry, I did not find anything.
David Richard
-
January 18th, 2012, 04:45 PM
#9
Re: Flushing the mouse buffer
Yes, I had the same problem. DataMiser's idea is right.
What I did:
Code:
Private sub imgButton_DblClick()
imgButton_MouseDown 0,0,0,0
End Sub
The double-click is then retransfered to the mouse_down() code.
It worked very well for me. I could then click as fast as possible to achieve all mose-down code.
Very easy solution...
-
January 20th, 2012, 06:25 AM
#10
Re: Flushing the mouse buffer
Originally Posted by WoF
Yes, I had the same problem. DataMiser's idea is right.
What I did:
Code:
Private sub imgButton_DblClick()
imgButton_MouseDown 0,0,0,0
End Sub
The double-click is then retransfered to the mouse_down() code.
It worked very well for me. I could then click as fast as possible to achieve all mose-down code.
Very easy solution...
Very nice indeed. Thanks for teaching me this as well
Tags for this Thread
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
|