How to detect a double click in freebasic?

New to FreeBASIC? Post your questions here.
Post Reply
student1347
Posts: 49
Joined: Dec 16, 2011 3:48

How to detect a double click in freebasic?

Post by student1347 »

How to detect a double click in freebasic?
Thanks in advance.
Imortis
Moderator
Posts: 1923
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: How to detect a double click in freebasic?

Post by Imortis »

See here:ScreenEvent
student1347
Posts: 49
Joined: Dec 16, 2011 3:48

Re: How to detect a double click in freebasic?

Post by student1347 »

Sorry How to detect a double click in freebasic outside of windows console?(win32)Microsoft® Win32® Programmer's Reference
Last edited by student1347 on Feb 02, 2018 0:39, edited 2 times in total.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: How to detect a double click in freebasic?

Post by grindstone »

Code: Select all

#Include "windows.bi"

Dim As Integer mx, my, mw, mb
Dim As Double timerem

Do
	GetMouse(mx, my, mw, mb)
	If (mb And 1) Then 'left mouse button
		Do
			timerem = Timer
			Do 'wait for mouse button release
				Sleep 1
				GetMouse(mx, my, mw, mb)
			Loop While (mb And 1)
			Do
				If ((Timer - timerem) * 1000) > GetDoubleClickTime() Then
					Print "single click"
					Exit Do, Do
				EndIf
				GetMouse(mx, my, mw, mb)
				If (mb And 1) Then
					Print "double click"
					Do 'wait for mouse button release
						Sleep 1
						GetMouse(mx, my, mw, mb)
					Loop While (mb And 1)
					Exit Do, Do
				EndIf
			Loop
		Loop
	EndIf
Loop
Post Reply