Solved

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

Posted on 2007-04-06
3
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
quiklearner earned 500 total points
ID: 18865413
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
ID: 18867940
quicklearner,

Very clever!
0
 

Author Comment

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

Featured Post

Windows running painfully slow? Try these tips..

Stay away from Speed Up Computer Programs that do more harm than good.
Try these tips instead.
Step by step instructions in trouble shooting Windows Performance issues.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't know how to downgrade, my instructions below should be helpful.
Find out what you should include to make the best professional email signature for your organization.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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