How to detect a double click in freebasic?

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

How to detect a double click in freebasic?

Postby student1347 » Feb 01, 2018 22:59

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

Re: How to detect a double click in freebasic?

Postby Imortis » Feb 01, 2018 23:06

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

Re: How to detect a double click in freebasic?

Postby student1347 » Feb 01, 2018 23:22

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: 792
Joined: May 05, 2015 5:35
Location: Germany

Re: How to detect a double click in freebasic?

Postby grindstone » Feb 02, 2018 0:02

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

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 11 guests