Solved

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

Posted on 2007-04-06
3
191 Views
Last Modified: 2010-04-30
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
Comment
Question by:B_B_Boris
3 Comments
 
LVL 4

Accepted Solution

by:
quiklearner earned 500 total points
Comment Utility
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
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
quicklearner,

Very clever!
0
 

Author Comment

by:B_B_Boris
Comment Utility
Thanks for your answer, quicklearner, it's clever indeed.
And the idea is quite simple, once you've understood it.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
If you don't know how to downgrade, my instructions below should be helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now