Article ID: 109865
Article Last Modified on 12/9/2003
' The following Function gets the DoubleClickSpeed from the WIN.INI
' file. Windows uses this setting to determine how close together two
' consecutive mouse clicks must occur for it to be interpreted as
' a double-click.
' Enter the following Declare statement on one, single line:
Declare Function GetProfileInt% Lib "Kernel" (ByVal lpAppName$,
ByVal lpKeyName$, ByVal nDefault%)
Sub Form_Load ()
clickSpeed% = GetProfileInt("Windows", "DoubleClickSpeed", 0)
Timer1.Enabled = False ' Timer should be off to begin with.
Timer1.Interval = clickSpeed% ' After the timer is turned on
' it will trigger the Timer Event
' after a specific amount of time
' equal to that of DoubleClickSpeed.
End Sub
Sub Form_Click ()
Timer1.Enabled = True ' Turn the timer on. If another mouse
' click does not occur within the
' DoubleClickSpeed interval, the
' Timer1_Timer Event will fire.
End Sub
Sub Form_DblClick ()
Timer1.Enabled = False ' Turn off the timer. This
' prevents the Timer1_Timer event
' from firing and thus the code
' for a single click will not be
' processed.
Print "This is a double-click" ' Code for double-click goes here.
End Sub
Sub Timer1_Timer ()
' If this event occurs then there has not been another mouse
' click since the previous one within the DoubleClickSpeed
' time interval. Thus there will be two Click events rather
' than a DblClick Event.
Timer1.Enabled = False ' Turn off the timer so the
' Timer1_Timer Event does not
' continue to fire.
Print "This is a Single Click" ' Code for single click goes here.
End Sub
Additional query words: 1.00 2.00 3.00
Keywords: KB109865