C
cookiesncreamychoc
Hi All,
Of all the posts out there, Outlook.exe doesnot disappear from task
manager mainly due to add-ins still referencing it.
I open outlook manually and the add-in loads, performs its functions
and then when I close outlook the Outlook.exe process gracefully
terminates. Yes, it does terminate all by itself so that would imply
the add-in cleans up after itself. Correct?
The problem arises when I open Outlook from C# (VS 2005) application
(to the calendar). The Outlook.exe lingers in the process list long
after the process is killed. The code is as follows:
Outlook.ApplicationClass oOutlook = new
Outlook.ApplicationClass();
Outlook.Application appOutlook = new Outlook.Application();
Outlook.MAPIFolder oCalendar;
Outlook.Explorer oEx = oOutlook.ActiveExplorer();
oCalendar = null;
if (oEx != null)
{
oCalendar =
oOutlook.Application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
oEx.CurrentFolder = oCalendar;
((Outlook._Explorer)oEx).Activate();
}
else
{
oCalendar =
appOutlook.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
oCalendar.Display();
}
oCalendar = null;
oEx = null;
appOutlook = null;
oOutlook = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
In the add-in, I handle the Explorer.Close and Inspector.Close events
and when ApplicationObject.Explorers.Count() = 0 and
ApplicationObject.Inspectors.Count() = 0, here is what I do...
oCalendarItem = Nothing
oDeletedItem = Nothing
oExplorer = Nothing
oInspector = Nothing
cInspector = Nothing
addInInstance = Nothing
Marshal.ReleaseComObject(addInInstance)
ApplicationObject = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
What am I doing wrong plzzzz???
Thanx
Of all the posts out there, Outlook.exe doesnot disappear from task
manager mainly due to add-ins still referencing it.
I open outlook manually and the add-in loads, performs its functions
and then when I close outlook the Outlook.exe process gracefully
terminates. Yes, it does terminate all by itself so that would imply
the add-in cleans up after itself. Correct?
The problem arises when I open Outlook from C# (VS 2005) application
(to the calendar). The Outlook.exe lingers in the process list long
after the process is killed. The code is as follows:
Outlook.ApplicationClass oOutlook = new
Outlook.ApplicationClass();
Outlook.Application appOutlook = new Outlook.Application();
Outlook.MAPIFolder oCalendar;
Outlook.Explorer oEx = oOutlook.ActiveExplorer();
oCalendar = null;
if (oEx != null)
{
oCalendar =
oOutlook.Application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
oEx.CurrentFolder = oCalendar;
((Outlook._Explorer)oEx).Activate();
}
else
{
oCalendar =
appOutlook.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
oCalendar.Display();
}
oCalendar = null;
oEx = null;
appOutlook = null;
oOutlook = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
In the add-in, I handle the Explorer.Close and Inspector.Close events
and when ApplicationObject.Explorers.Count() = 0 and
ApplicationObject.Inspectors.Count() = 0, here is what I do...
oCalendarItem = Nothing
oDeletedItem = Nothing
oExplorer = Nothing
oInspector = Nothing
cInspector = Nothing
addInInstance = Nothing
Marshal.ReleaseComObject(addInInstance)
ApplicationObject = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
What am I doing wrong plzzzz???
Thanx