Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

Capture double-click in Outlook add-in (in Visual Basic 6)

Hi there,

I've written an add-in in Visual Basic 6 which adds a button to Outlook which
does things when it's clicked.
I've been told it would be nice if the button did something else
when the button is double-clicked.
Is there a way for an outlook button to capture a double click ?

Thanks in advance, here's my code.


Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal _
  ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
  ByVal AddInInst As Object, custom() As Variant)
   
    On Error GoTo error_handler_OnConnection

    Set appOutlook = Application

    Dim LB_found As Boolean
    LB_found = False
   
    Dim LO_tmp As CommandBarControl
    For Each LO_tmp In appOutlook.ActiveExplorer.CommandBars("Standard").Controls
        If LO_tmp.DescriptionText = my_description_text Then
            Set my_button = LO_tmp
            LB_found = True
        End If
    Next

    If Not LB_found Then
        Set my_button = appOutlook.ActiveExplorer.CommandBars("Standard").Controls.Add(msoControlButton, Temporary:=True)
        my_button.Caption = LoadResString(TEXT_CALL)
        my_button.FaceId = 275
        my_button.DescriptionText = my_description_text
        my_button.Style = msoButtonIconAndCaption
        my_button.ToolTipText = LoadResString(TEXT_CALL_WITH_9_PASS)
        my_button.OnAction = "!<Addin_29032007.Connect>"
        my_button.BeginGroup = True
    End If

    Exit Sub
   
error_handler_OnConnection:
   
    MsgBox Err.Description
   
End Sub
0
B_B_Boris
Asked:
B_B_Boris
1 Solution
 
quiklearnerCommented:
Since Outlook doesn't offer that event, you'd need to write the code yourself to handle it..  I would:

1) create a timer in which i would move the current click code out of the click and move to the timer.  I would also add a timer.enable = false to the end of the timer event
2) within the initialization code set the timer's interval to the current users interval (registry HKCurrentUser\Control Panel\Mouse\DoubleClickSpeed
3) make sure the timer is disabled by default
4) within the click event, check to see if the timer is enabled.  If it is, disable it and run your double click code.  If it is not enable the timer..


Bingo, your own double click event!!!
0
 
David LeeCommented:
quicklearner,

Very clever!
0
 
B_B_BorisAuthor Commented:
Thanks for your answer, quicklearner, it's clever indeed.
And the idea is quite simple, once you've understood it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now