PDA

Click to See Complete Forum and Search --> : delay in closing outlook addin


maes
Feb 3rd, 2005, 02:57 AM
Hi,

I have an outlook addin written in VB.NET
It puts an extra button in the standard toolbar that will display my custom form when clicked.

But when I close down outlook, it stays running in the background for a few seconds and then outlook shutsdown.
It's not that outlook is waiting for my code to close something (I think) because the onBeginShutdown, onDisconnection messages aren't fired earlyer.
But when I remove the code that adds the button (empty addin) everything goes smoothly.
So it has something to do in the way I create my button.
This is how I do it:

private objCBar As Microsoft.Office.Core.CommandBar
private formButton As Microsoft.Office.Core.CommandBarButton

...

Public Sub OnStartupComplete(...)
Try
formButton = applicationObject.ActiveExplorer.CommandBars.Item("Standard").Controls.Add(Temporary:=True)
With formButton
.Caption = "my form"
.TooltipText = "open my form"
.Visible = True
End With
AddHandler formButton.Click, AddressOf CustomFormButton_Click
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Custom form addin Exception")
End Try


Public Sub OnBeginShutdown(...)
'clean up
objCBar = Nothing
formButton = Nothing
End Sub


I'm not getting any exceptions (code runs fine) it's just slow when closing outlook.
Am I forgetting to close something?

Thanks,

--maes