outlook add-in crashes on folder-switch 
Author Message
 outlook add-in crashes on folder-switch

Hi all,

Have a problem with Outlook crashing when you add an add-in, remove
the add-in and change folders in outlook. If you close down Outlook
and start it anew it works fine.

I've narrowed it down to that the symptom appears when the add-in
places a control button in the standard commandbar or any of the
standard menus. If the added buttons are deleted (with the
delete-method) on exeting the add-in Outlook will crash on
folderswitch.

I cannot debug the program, since the program isn't loaded any longer
when the problem appears.

Has anyone experiences any similiar problem, or have any solutions?

Thanks,

Dennis



Sat, 03 Apr 2004 00:46:33 GMT  
 outlook add-in crashes on folder-switch
That usually is caused by not completely releasing all objects
correctly. Take a look at the sample COM add-in ItemsCB from Randy
Byrne to see everything that is needed. Look at the Inspector and
Explorer Close events in particular. The add-in is on the Resources
page at www.microeye.com

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning Visual Basic 6 Application Development, Wrox
Press


Quote:
> Hi all,

> Have a problem with Outlook crashing when you add an add-in, remove
> the add-in and change folders in outlook. If you close down Outlook
> and start it anew it works fine.

> I've narrowed it down to that the symptom appears when the add-in
> places a control button in the standard commandbar or any of the
> standard menus. If the added buttons are deleted (with the
> delete-method) on exeting the add-in Outlook will crash on
> folderswitch.

> I cannot debug the program, since the program isn't loaded any
longer
> when the problem appears.

> Has anyone experiences any similiar problem, or have any solutions?

> Thanks,

> Dennis



Sat, 03 Apr 2004 21:30:06 GMT  
 outlook add-in crashes on folder-switch
First: Ken, thanks for your reply.

I'm familiar with the Explorer and Inspector, and their close events
and I'm positive all the objects are released in propper fashion. In
fact only some of the objects causes Outlook to hang although they are
called and released identically.

I've investigated the issue further and have so far come to the
conclusion that the bug must be in Outlook and not in my code. When I
test Outlook add-ins developed by Microsoft, e.g. Personal Folders
Backup available from
http://office.microsoft.com/downloads/2002/pfbackup.aspx I get the
same behavior by:

1. Install the plugin.
2. Choose Tools/Options/Other/Advanced Options/Add-In Manager and
uncheck the checkbox.
3. Click OK till you're back in Outlook.
4. Switch folders to the Calendar.
5. Outlook will hang and "crash".

I've exeperienced the same behavior with several Outlook add-ins
available for download. It seems that whenever the add-in adds objects
to Outlooks standard command bar or menu bars Outlook will crash when
changing the visual properties of those command/menu bars if the
add-in is unloaded.

I assue the bug must be in Outlook, which does not relesase all
objects untill restarted.

Can anyone confirm/decline this?

Dennis Nkangi


Quote:
> That usually is caused by not completely releasing all objects
> correctly. Take a look at the sample COM add-in ItemsCB from Randy
> Byrne to see everything that is needed. Look at the Inspector and
> Explorer Close events in particular. The add-in is on the Resources
> page at www.microeye.com

> --
> Ken Slovak
> [MVP - Outlook]
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning Visual Basic 6 Application Development, Wrox
> Press



> > Hi all,

> > Have a problem with Outlook crashing when you add an add-in, remove
> > the add-in and change folders in outlook. If you close down Outlook
> > and start it anew it works fine.

> > I've narrowed it down to that the symptom appears when the add-in
> > places a control button in the standard commandbar or any of the
> > standard menus. If the added buttons are deleted (with the
> > delete-method) on exeting the add-in Outlook will crash on
> > folderswitch.

> > I cannot debug the program, since the program isn't loaded any
>  longer
> > when the problem appears.

> > Has anyone experiences any similiar problem, or have any solutions?

> > Thanks,

> > Dennis



Sun, 04 Apr 2004 15:53:14 GMT  
 outlook add-in crashes on folder-switch
Well, I wouldn't use PFBackup as an example, it has the problem of not
properly releasing all objects and it keeps Outlook memory resident.

Usually when you have that problem with added buttons on a toolbar or
menu for an Explorer it is because the BeforeFolderSwitch event isn't
used for the button or objects aren't released properly. I've seen it
myself in add-ins and fixed it along the way. I do know that the
commercial add-ins I've written don't have that problem when disabled
or removed if they are adding a button. I'd still suggest checking out
Randy's ItemsCB Com add-in sample.

There was a bug about menu/toolbar items duplicating themselves and
sometimes crashing Outlook in Outlook 2000 gold, but that was fixed in
SR1 and later.
--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning Visual Basic 6 Application Development, Wrox
Press


Quote:
> First: Ken, thanks for your reply.

> I'm familiar with the Explorer and Inspector, and their close events
> and I'm positive all the objects are released in propper fashion. In
> fact only some of the objects causes Outlook to hang although they
are
> called and released identically.

> I've investigated the issue further and have so far come to the
> conclusion that the bug must be in Outlook and not in my code. When
I
> test Outlook add-ins developed by Microsoft, e.g. Personal Folders
> Backup available from
> http://office.microsoft.com/downloads/2002/pfbackup.aspx I get the
> same behavior by:

> 1. Install the plugin.
> 2. Choose Tools/Options/Other/Advanced Options/Add-In Manager and
> uncheck the checkbox.
> 3. Click OK till you're back in Outlook.
> 4. Switch folders to the Calendar.
> 5. Outlook will hang and "crash".

> I've exeperienced the same behavior with several Outlook add-ins
> available for download. It seems that whenever the add-in adds objec
ts
> to Outlooks standard command bar or menu bars Outlook will crash
when
> changing the visual properties of those command/menu bars if the
> add-in is unloaded.

> I assue the bug must be in Outlook, which does not relesase all
> objects untill restarted.

> Can anyone confirm/decline this?

> Dennis Nkangi



Sun, 04 Apr 2004 21:31:22 GMT  
 outlook add-in crashes on folder-switch
I figured PFBackup would be a good example since it was distributed
from MSDN. I've looked at several other Outlook add-ins and haven't
been able to find an add-in that adds buttons to the standard command
bar or a default menu, that does not hang when disabled. Perhaps you
know of a downloadable add-in with that behavior?

I studied Randy's ItemsCB Com add-in sample - thanks for the tip - and
I do have all connections closed down as in the sample. The difference
between my add-in and the one in the sample is that I add buttons to
the standard command bar. If the buttons are left undeleted on the
bar, the add-in can be disabled without problems, but if I delete any
of the buttons (using the button's Delete-method) Outlook hangs when
the add-in is disabled. If I make a custom command bar, there are no
problems at all. I can also delete custom buttons from the Tools menu
without the same behavior.

Other than that, the example uses VB6, I'm using VB5, but I figure
that shouldn't cause any problems.

Thanks for the assistance, Ken.

Dennis Nkangi


Quote:
> Well, I wouldn't use PFBackup as an example, it has the problem of not
> properly releasing all objects and it keeps Outlook memory resident.

> Usually when you have that problem with added buttons on a toolbar or
> menu for an Explorer it is because the BeforeFolderSwitch event isn't
> used for the button or objects aren't released properly. I've seen it
> myself in add-ins and fixed it along the way. I do know that the
> commercial add-ins I've written don't have that problem when disabled
> or removed if they are adding a button. I'd still suggest checking out
> Randy's ItemsCB Com add-in sample.

> There was a bug about menu/toolbar items duplicating themselves and
> sometimes crashing Outlook in Outlook 2000 gold, but that was fixed in
> SR1 and later.
> --
> Ken Slovak
> [MVP - Outlook]
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning Visual Basic 6 Application Development, Wrox
> Press



> > First: Ken, thanks for your reply.

> > I'm familiar with the Explorer and Inspector, and their close events
> > and I'm positive all the objects are released in propper fashion. In
> > fact only some of the objects causes Outlook to hang although they
>  are
> > called and released identically.

> > I've investigated the issue further and have so far come to the
> > conclusion that the bug must be in Outlook and not in my code. When
>  I
> > test Outlook add-ins developed by Microsoft, e.g. Personal Folders
> > Backup available from
> > http://office.microsoft.com/downloads/2002/pfbackup.aspx I get the
> > same behavior by:

> > 1. Install the plugin.
> > 2. Choose Tools/Options/Other/Advanced Options/Add-In Manager and
> > uncheck the checkbox.
> > 3. Click OK till you're back in Outlook.
> > 4. Switch folders to the Calendar.
> > 5. Outlook will hang and "crash".

> > I've exeperienced the same behavior with several Outlook add-ins
> > available for download. It seems that whenever the add-in adds objec
>  ts
> > to Outlooks standard command bar or menu bars Outlook will crash
>  when
> > changing the visual properties of those command/menu bars if the
> > add-in is unloaded.

> > I assue the bug must be in Outlook, which does not relesase all
> > objects untill restarted.

> > Can anyone confirm/decline this?

> > Dennis Nkangi



Mon, 05 Apr 2004 15:57:18 GMT  
 outlook add-in crashes on folder-switch
Which menu are you adding things to? Is it Actions? You know there are
different Actions menus for different folder types. There might be
some examples that work with the "Menu Bar" CommandBar up at
Slipstick, at http://www.slipstick.com/dev/comaddins.htm but I don't
think so. I have my own examples, but they are all for customers.

Can you post some of you relevant shutdown code?

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning Visual Basic 6 Application Development, Wrox
Press


Quote:
> I figured PFBackup would be a good example since it was distributed
> from MSDN. I've looked at several other Outlook add-ins and haven't
> been able to find an add-in that adds buttons to the standard
command
> bar or a default menu, that does not hang when disabled. Perhaps you
> know of a downloadable add-in with that behavior?

> I studied Randy's ItemsCB Com add-in sample - thanks for the tip -
and
> I do have all connections closed down as in the sample. The
difference
> between my add-in and the one in the sample is that I add buttons to
> the standard command bar. If the buttons are left undeleted on the
> bar, the add-in can be disabled without problems, but if I delete
any
> of the buttons (using the button's Delete-method) Outlook hangs when
> the add-in is disabled. If I make a custom command bar, there are no
> problems at all. I can also delete custom buttons from the Tools
menu
> without the same behavior.

> Other than that, the example uses VB6, I'm using VB5, but I figure
> that shouldn't cause any problems.

> Thanks for the assistance, Ken.

> Dennis Nkangi



Mon, 05 Apr 2004 22:23:56 GMT  
 outlook add-in crashes on folder-switch
I'm adding command bar buttons (Office.CommandBarButton) to two menus:
File/New-menu, Tools-menu. I also put a different instance of a
similar button on the standard command bar (before the print button).

I've noticed the New-menu changes depending on which folder you're
currently in. The visual appearance of the standard command bar also
changes. When I look at the objects in debug mode it seems that the
same menu object will set its Button.Visible properties to True/False
depending on folder type. Do you mean that the menu object will
actually change with folder type?

Some of the shutdown code:

----
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As _
                AddInDesignerObjects.ext_DisconnectMode, custom() As
Variant)
    ' Remove references from Application
    If RemoveMode = ext_dm_UserClosed Then
        ' Remove added buttons
        oMyOlObject.RemoveShortcuts
    End If

    oHandler.UnInitHandler
End Sub

Private Sub moActiveExplorer_Close()
    On Error Resume Next
    If oOlApplication.Explorers.Count <= 1 Then
        UnInitHandler
    End If
End Sub

Public Sub RemoveShortcuts()
    On Error Resume Next

    If Not (oMyButton Is Nothing) Then oMyButton.Delete
    If Not (oMyButton2 Is Nothing) Then oMyButton2.Delete
    If Not (oMyButton3 Is Nothing) Then oMyButton3.Delete

End Sub
----

Some comments:
- I'm not instantiating any Inspector objects, therefor they are not
respected during shutdown.
- The only thing the UnInitHandler Sub does is setting all objects to
Nothing.
- If I leave out the RemoveShortcuts sub the application does not
crash.

I've done some further testing and noticed the behavior is not
reproduced in Outlook 2002, on Win2000. I was earlier running Outlook
2000, on Win2000. In Outlook 2002 I can disable my add-in without
crashing Outlook (PFBackup also works fine in Outlook 2002).

Dennis Nkangi


Quote:
> Which menu are you adding things to? Is it Actions? You know there are
> different Actions menus for different folder types. There might be
> some examples that work with the "Menu Bar" CommandBar up at
> Slipstick, at http://www.slipstick.com/dev/comaddins.htm but I don't
> think so. I have my own examples, but they are all for customers.

> Can you post some of you relevant shutdown code?

> --
> Ken Slovak
> [MVP - Outlook]
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning Visual Basic 6 Application Development, Wrox
> Press



> > I figured PFBackup would be a good example since it was distributed
> > from MSDN. I've looked at several other Outlook add-ins and haven't
> > been able to find an add-in that adds buttons to the standard
>  command
> > bar or a default menu, that does not hang when disabled. Perhaps you
> > know of a downloadable add-in with that behavior?

> > I studied Randy's ItemsCB Com add-in sample - thanks for the tip -
>  and
> > I do have all connections closed down as in the sample. The
>  difference
> > between my add-in and the one in the sample is that I add buttons to
> > the standard command bar. If the buttons are left undeleted on the
> > bar, the add-in can be disabled without problems, but if I delete
>  any
> > of the buttons (using the button's Delete-method) Outlook hangs when
> > the add-in is disabled. If I make a custom command bar, there are no
> > problems at all. I can also delete custom buttons from the Tools
>  menu
> > without the same behavior.

> > Other than that, the example uses VB6, I'm using VB5, but I figure
> > that shouldn't cause any problems.

> > Thanks for the assistance, Ken.

> > Dennis Nkangi



Tue, 06 Apr 2004 15:53:57 GMT  
 outlook add-in crashes on folder-switch
I think on the New menu that it just makes visible/invisible certain
items, but you can check that by getting the ID of the menu in
different folders. I'd also instantiate an Inspectors object just
because if anyone uses SendTo then an Inspector is instantiated with
no Explorers, so you need to trap that.

There may be a bug in Outlook 2000 that was fixed in Outlook 2002 that
could affect this, I'm not sure. I've never used a new button in New
so I haven't tested that. If I get a chance I'll do so sometime later
this week.

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning Visual Basic 6 Application Development, Wrox
Press


Quote:
> I'm adding command bar buttons (Office.CommandBarButton) to two
menus:
> File/New-menu, Tools-menu. I also put a different instance of a
> similar button on the standard command bar (before the print
button).

> I've noticed the New-menu changes depending on which folder you're
> currently in. The visual appearance of the standard command bar also
> changes. When I look at the objects in debug mode it seems that the
> same menu object will set its Button.Visible properties to
True/False
> depending on folder type. Do you mean that the menu object will
> actually change with folder type?

> Some of the shutdown code:

> ----
> Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As _
>                 AddInDesignerObjects.ext_DisconnectMode, custom() As
> Variant)
>     ' Remove references from Application
>     If RemoveMode = ext_dm_UserClosed Then
>         ' Remove added buttons
>         oMyOlObject.RemoveShortcuts
>     End If

>     oHandler.UnInitHandler
> End Sub

> Private Sub moActiveExplorer_Close()
>     On Error Resume Next
>     If oOlApplication.Explorers.Count <= 1 Then
>         UnInitHandler
>     End If
> End Sub

> Public Sub RemoveShortcuts()
>     On Error Resume Next

>     If Not (oMyButton Is Nothing) Then oMyButton.Delete
>     If Not (oMyButton2 Is Nothing) Then oMyButton2.Delete
>     If Not (oMyButton3 Is Nothing) Then oMyButton3.Delete

> End Sub
> ----

> Some comments:
> - I'm not instantiating any Inspector objects, therefor they are not
> respected during shutdown.
> - The only thing the UnInitHandler Sub does is setting all objects
to
> Nothing.
> - If I leave out the RemoveShortcuts sub the application does not
> crash.

> I've done some further testing and noticed the behavior is not
> reproduced in Outlook 2002, on Win2000. I was earlier running
Outlook
> 2000, on Win2000. In Outlook 2002 I can disable my add-in without
> crashing Outlook (PFBackup also works fine in Outlook 2002).

> Dennis Nkangi



Sat, 10 Apr 2004 04:55:38 GMT  
 outlook add-in crashes on folder-switch
I now see the point of trapping the Inspector object, didn't know
Outlook could actually be running without any Explorer objects.

Still not sure whether the error with the New menu is due to a bug or
development error, anyway will get to a workaround to that problem.

Thanks for all the help.

Dennis Nkangi


Quote:
> I think on the New menu that it just makes visible/invisible certain
> items, but you can check that by getting the ID of the menu in
> different folders. I'd also instantiate an Inspectors object just
> because if anyone uses SendTo then an Inspector is instantiated with
> no Explorers, so you need to trap that.

> There may be a bug in Outlook 2000 that was fixed in Outlook 2002 that
> could affect this, I'm not sure. I've never used a new button in New
> so I haven't tested that. If I get a chance I'll do so sometime later
> this week.

> --
> Ken Slovak
> [MVP - Outlook]
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning Visual Basic 6 Application Development, Wrox
> Press



> > I'm adding command bar buttons (Office.CommandBarButton) to two
>  menus:
> > File/New-menu, Tools-menu. I also put a different instance of a
> > similar button on the standard command bar (before the print
>  button).

> > I've noticed the New-menu changes depending on which folder you're
> > currently in. The visual appearance of the standard command bar also
> > changes. When I look at the objects in debug mode it seems that the
> > same menu object will set its Button.Visible properties to
>  True/False
> > depending on folder type. Do you mean that the menu object will
> > actually change with folder type?

> > Some of the shutdown code:

> > ----
> > Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As _
> >                 AddInDesignerObjects.ext_DisconnectMode, custom() As
> > Variant)
> >     ' Remove references from Application
> >     If RemoveMode = ext_dm_UserClosed Then
> >         ' Remove added buttons
> >         oMyOlObject.RemoveShortcuts
> >     End If

> >     oHandler.UnInitHandler
> > End Sub

> > Private Sub moActiveExplorer_Close()
> >     On Error Resume Next
> >     If oOlApplication.Explorers.Count <= 1 Then
> >         UnInitHandler
> >     End If
> > End Sub

> > Public Sub RemoveShortcuts()
> >     On Error Resume Next

> >     If Not (oMyButton Is Nothing) Then oMyButton.Delete
> >     If Not (oMyButton2 Is Nothing) Then oMyButton2.Delete
> >     If Not (oMyButton3 Is Nothing) Then oMyButton3.Delete

> > End Sub
> > ----

> > Some comments:
> > - I'm not instantiating any Inspector objects, therefor they are not
> > respected during shutdown.
> > - The only thing the UnInitHandler Sub does is setting all objects
>  to
> > Nothing.
> > - If I leave out the RemoveShortcuts sub the application does not
> > crash.

> > I've done some further testing and noticed the behavior is not
> > reproduced in Outlook 2002, on Win2000. I was earlier running
>  Outlook
> > 2000, on Win2000. In Outlook 2002 I can disable my add-in without
> > crashing Outlook (PFBackup also works fine in Outlook 2002).

> > Dennis Nkangi



Sat, 10 Apr 2004 20:03:19 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. OVC crashes Outlook when switching back and forth continuously between folders

2. Add-in causes Outlook crash when Outlook launches as a result of email hyperlink

3. Switch outlook folders

4. Since adding VBA outlook crashes.

5. Adding fields to Outlook'02/00 folder

6. VBA add other users mailboxes to the outlook explorer / folder tree

7. Add folder with contactsitems to Outlook Address Book

8. Add folder to Outlook 2000

9. how to create / add a MAPI Folder in outlook 2000

10. Add attachments linked to elements of the outlook folder system

11. DataGrid Crashes when switching Datasource

12. Application crashes when switching between forms

 

 
Powered by phpBB® Forum Software