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 » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

My Com Add-ins cause outlook process blocked



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 22nd 06, 03:16 AM posted to microsoft.public.outlook
jz
external usenet poster
 
Posts: 2
Default My Com Add-ins cause outlook process blocked

Hi All,

I have developped an outlook Com Add-in and normaly my add in works
fine;
but when I ran it under W2K outlook 2000, I got a problem, the outlook
window is closed
but I can still find outlook.exe process in the task manager, that will
cause my Com Add-in Loading failure.

If I remove my Add In, the outlook is closed properly;
Here is what I am doing in my souce code:


Implements IDTExtensibility2

Dim WithEvents objApp As OUTLOOK.Application
Dim WithEvents objOutlookExp As OUTLOOK.Explorer
Dim WithEvents objActiveInspector As OUTLOOK.inspector
Public WithEvents objItems As OUTLOOK.Items
Dim WithEvents objAppointItem As OUTLOOK.AppointmentItem
Dim objInspector As OUTLOOK.inspector
Dim WithEvents objButtonInstant As Office.CommandBarButton
Dim WithEvents objButtonSchedule As Office.CommandBarButton
Dim objCommandBar As Office.CommandBar
Dim WithEvents Inspectors As OUTLOOK.Inspectors



then in the funciton


Private Sub objOutlookExp_Close()
'Release Explorer Object
'Set objOutlookExp = Nothing
If objApp.Explorers.Count = 1 Then
objCommandBar.Delete
Call Class_Terminate
End If
End Sub


here is the Class_Terminate function



Private Sub Class_Terminate()
MsgBox "Enter the terminate function"

Set objButtonSchedule = Nothing
Set objButtonInstant = Nothing
Set objAppointItem = Nothing
Set objItems = Nothing
Set objActiveInspector = Nothing
Set Inspectors = Nothing
Set objOutlookExp = Nothing
Set objApp = Nothing

End Sub


I add msgbox here to debug. it is called correctly;

I did like what it is said in the book of Ken Slovak;

Can someone point out my problem;

and it there a way to force the process outlook.exe to be terminated?



Thank you very much



jz

  #2  
Old February 22nd 06, 03:56 PM posted to microsoft.public.outlook
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default My Com Add-ins cause outlook process blocked

I count at least 2 objects that you aren't releasing in your close down
code. You need to be very careful to not keep any Outlook derived objects or
the addin won't let Outlook close. Another key thing to do is to make sure
you handle every possible error with an error handler.

Your test code should also be testing for Inspectors.Count as well as
Explorers.Count.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"jz" wrote in message
oups.com...
Hi All,

I have developped an outlook Com Add-in and normaly my add in works
fine;
but when I ran it under W2K outlook 2000, I got a problem, the outlook
window is closed
but I can still find outlook.exe process in the task manager, that will
cause my Com Add-in Loading failure.

If I remove my Add In, the outlook is closed properly;
Here is what I am doing in my souce code:


Implements IDTExtensibility2

Dim WithEvents objApp As OUTLOOK.Application
Dim WithEvents objOutlookExp As OUTLOOK.Explorer
Dim WithEvents objActiveInspector As OUTLOOK.inspector
Public WithEvents objItems As OUTLOOK.Items
Dim WithEvents objAppointItem As OUTLOOK.AppointmentItem
Dim objInspector As OUTLOOK.inspector
Dim WithEvents objButtonInstant As Office.CommandBarButton
Dim WithEvents objButtonSchedule As Office.CommandBarButton
Dim objCommandBar As Office.CommandBar
Dim WithEvents Inspectors As OUTLOOK.Inspectors



then in the funciton


Private Sub objOutlookExp_Close()
'Release Explorer Object
'Set objOutlookExp = Nothing
If objApp.Explorers.Count = 1 Then
objCommandBar.Delete
Call Class_Terminate
End If
End Sub


here is the Class_Terminate function



Private Sub Class_Terminate()
MsgBox "Enter the terminate function"

Set objButtonSchedule = Nothing
Set objButtonInstant = Nothing
Set objAppointItem = Nothing
Set objItems = Nothing
Set objActiveInspector = Nothing
Set Inspectors = Nothing
Set objOutlookExp = Nothing
Set objApp = Nothing

End Sub


I add msgbox here to debug. it is called correctly;

I did like what it is said in the book of Ken Slovak;

Can someone point out my problem;

and it there a way to force the process outlook.exe to be terminated?



Thank you very much



jz


  #3  
Old February 23rd 06, 05:16 AM posted to microsoft.public.outlook
jz
external usenet poster
 
Posts: 2
Default My Com Add-ins cause outlook process blocked

Thank you Ken, you are right, but also I observed that the order of the
objects to be cleaned is also very important; if I did respect set to
nothing from small objects to container, then it won't close correctly.

  #4  
Old February 23rd 06, 03:38 PM posted to microsoft.public.outlook
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default My Com Add-ins cause outlook process blocked

I always start with my collections and unwind them if they contain objects
before I release the collection:

For i = colWhatever.Count To 1 Step -1
colWhatever.Remove i
Next
Set colWhatever = Nothing

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"jz" wrote in message
oups.com...
Thank you Ken, you are right, but also I observed that the order of the
objects to be cleaned is also very important; if I did respect set to
nothing from small objects to container, then it won't close correctly.


 




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
outlook process never closes??? luis Outlook - General Queries 4 April 22nd 06 03:47 PM
backing up a .pst file - another process has locked a portion of the file? [email protected] Outlook - General Queries 1 February 19th 06 04:44 AM
Junk mail: How to create a button for "Add sender to blocked sender list" Nananana Outlook - General Queries 2 February 2nd 06 01:37 PM
Blocked attachment Emyeu Outlook - General Queries 4 January 27th 06 06:26 PM


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.