A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Addin button not showing up -- problem with ActiveExplorer?



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 13th 07, 07:53 PM posted to microsoft.public.outlook.program_addins
[email protected]
external usenet poster
 
Posts: 3
Default Addin button not showing up -- problem with ActiveExplorer?

Hey all,

Apologies for the ensuing long-winded post, but I want to be as clear
as I can about what's going on.

I have a COM addin that was developed for Outlook 2002/XP and later.
It began in VBA but was eventually wholly migrated to .NET in order to
incorporate XML web services which are an integral part of it. It's
supposed to create a new button in the standard Outlook toolbar that
runs the program (which acts like a standard wizard tool). Most
clients report no problem with the install, but a few have reported
that the button doesn't show up when they install the addin, and there
doesn't seem to be any consistency as to what versions of Windows or
Outlook they are running. (i.e. the issue has occurred on a Windows
2000 machine as well as XP). The frustrating part is that, up until
recently, I've been completely unable to replicate the issue in-house.

However, I recently dug out an old laptop running Windows 2000 and
Outlook 2002, and after attempting to install the addin I finally see
what the client sees. The addin does in fact get added to the COM Add-
ins list in Outlook, and the box is checked, but the button does not
appear in the toolbar. I've checked the registry, and the correct
entries are added into HKCU and HKCR. Comparing the registry settings
on another machine where the addin installs just fine, they are
identical from what I can tell. If I uncheck and re-check the box in
the addins list, a runtime error occurs and the LoadBehavior key in
the registry switches from 3 to 2.

After compiling a few different test versions of the addin with print
statements in various places, I've determined that the OnConnection
event is firing successfully. Also, the OnStartupComplete event will
fire with a print statement there and nothing else. However, the
moment I add the first piece of the code that loads the button into
the toolbar, the addin no longer works. Anything related to the
ActiveExplorer will kill the addin silently upon loading. No amount
of try/catching or if/elsing will prevent the failure, and print
statements no longer get executed no matter where they're placed in
OnStartupComplete.

Now, if I forget about trying to load the button into the toolbar and
instead call my code directly from the OnConnection event, the program
itself comes up and works flawlessly as soon as the user opens
Outlook. Of course, once they close the program, it becomes
unavailable until they restart Outlook because there's no button,
which is less than ideal. But it at least shows that the code itself
isn't the problem. There seems to be some kind of malfunction when
trying to access the ActiveExplorer, almost as if it doesn't exist at
the point which it's being called.

Outlook itself is not being opened via ActiveSync or any other method
that I'm aware of -- I'm just opening it like any of us would, so
there should be a UI available, yes? I've pin-pointed exactly where
the addin fails to load, but I'm completely lost as to how I should
get around this. Below is my code from the Connect class -- there's
nothing terribly different about it from what I've seen in other
posts, but maybe there's something blaring there that I'm missing.
Any assistance that ANYONE can give at this point would be most
appreciated.

Thank you all in advance,
Steve

=========================================

Imports Microsoft.Office.Core
Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Core.MsoControlType
Imports Microsoft.Office.Core.MsoBarPosition
Imports Microsoft.Office.Core.MsoButtonStyle
Imports Microsoft.Office.Core.MsoFileDialogType
Imports Microsoft.Office.Core.MsoFileDialogView
Imports Microsoft.Office.Core.MsoTriState

GuidAttribute("5ccfec6f-5ea3-48d6-92ac-192842cf866b"),
ProgIdAttribute("MyWizard.Connect") _
Public Class Connect
Implements Extensibility.IDTExtensibility2

Dim applicationObject As Object
Dim addInInstance As Object
Dim WithEvents objCommandBarButton As CommandBarButton

Public Sub OnBeginShutdown(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnBeginShutdown
'On Error Resume Next
objCommandBarButton.Delete()
objCommandBarButton = Nothing
End Sub

Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
End Sub

Public Sub OnStartupComplete(ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnStartupComplete
DisplayMsgBox("on startup complete running")
'DisplayMsgBox("on startup complete running")
Dim objCommandBars As CommandBars
Dim objCommandBar As CommandBar
Dim objCommandBarControl As CommandBarControl

' Create a menu command on the "Tools" menu.
Try
objCommandBars =
applicationObject.ActiveExplorer.CommandBars
'DisplayMsgBox("menu command works")
Catch ex As Exception
'DisplayMsgBox(ex.Message)
objCommandBars = applicationObject.CommandBars
End Try

Try
objCommandBar = objCommandBars.Item("Standard")
'DisplayMsgBox("standard menu works")
Catch ex As Exception
objCommandBar = objCommandBars.Add("MyWizard",
msoBarFloating, , True)
'DisplayMsgBox("floating menu should be created")
End Try
objCommandBar.Visible = True

'Make sure menu command doesn't already exist.
For Each objCommandBarControl In objCommandBar.Controls
If objCommandBarControl.Caption = "MyWizard" Then
objCommandBar.Controls.Item("MyWizard").Delete()
End If
Next objCommandBarControl

objCommandBarButton =
objCommandBar.Controls.Add(msoControlButton, , , , True)
With objCommandBarButton
.Caption = "MyWizard"
.Style = msoButtonCaption
.Tag = "MyWizard"
.OnAction = "!MyWizard.Connect"
.Visible = True
End With
End Sub

Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array)
Implements Extensibility.IDTExtensibility2.OnDisconnection
On Error Resume Next

' Disconnect the shared add-in, no matter how the host
application
' was shut down.
If RemoveMode
Extensibility.ext_DisconnectMode.ext_dm_HostShutdo wn Then _
Call OnBeginShutdown(custom)

applicationObject = Nothing
End Sub

Public Sub OnConnection(ByVal application As Object, ByVal
connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As
Object, ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnConnection
applicationObject = application
addInInstance = addInInst

' No matter how the host application started, connect the
shared add-in.
If (connectMode
Extensibility.ext_ConnectMode.ext_cm_Startup) Then _
Call OnStartupComplete(custom)
End Sub

Private Sub objCommandBarButton_Click(ByVal Ctrl As
CommandBarButton, _
ByRef CancelDefault As Boolean) Handles
objCommandBarButton.Click

' These are the two functions that initialize the wizard.
' The program works fine when these are called from
OnConnection.
ConfigureEnv()
RunPasswordForm()

End Sub

End Class


=========================================

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
com addin button callbacks. Daniel Add-ins for Outlook 1 February 22nd 07 09:17 PM
Attaching an Addin to Send Button [email protected] Add-ins for Outlook 1 January 12th 07 04:18 PM
A different problem with Outlook Addin Ram Add-ins for Outlook 1 April 24th 06 03:31 PM
OCX problem in VB Outlook AddIn Rui Oliveira Add-ins for Outlook 0 March 31st 06 05:42 PM
unload COM addin problem David Cebrian Add-ins for Outlook 3 February 9th 06 11:26 AM


All times are GMT +1. The time now is 08:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.