Outlook 2000 Com object in C# doesnt quit

P

palouf

Hi everybody.
I try to build some Outlook 2000 / XP Addin,
It works fine with the XP version, but with OL 2k, nothing to do, it never
quits outlook (i can see it in the process list) I read in a microsoft
article that this could happen when all the Com_object instances are not set
to null. This is what i have done ((or seems to)) but it doesn't quit too.
So my questions are following :
1 . is there a way to see in one round alla the instances of the com_objects
2. is there something special to do with OL 2K to make it quit.

I hope smone will be able to help Me !!!
Thanks a lot even if you spent a bit of time reading this post and doesn't
have the answer
Pascal

her's mys code :
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.email_envoye);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.email_recu);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.emails_envoyes)
;
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.emails_recus);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
try
{
this.espace = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.espace);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.inboxFolder);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.outboxFolder);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
this.email_envoye = null;
this.email_recu = null;
this.emails_envoyes = null;
this.emails_recus = null;
this.espace = null;
this.inboxFolder = null;
this.outboxFolder = null;
this.addInInstance = null;


if(disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
{
OnBeginShutdown(ref custom);
}
app = null;
try
{
this.app.Quit();
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString());
}
 
J

Jay B. Harlow [MVP - Outlook]

palouf,
Have you looked over this site?
http://www.microeye.com/resources/res_outlookvsnet.htm

It lists a number of resources available when using Outlook with .NET.

I've been reading ".NET and COM - The Complete Interoperability Guide" by
Adam Nathan from SAMS. Two things he stated that makes sense.

1. ReleaseComObject items in the correct order, release child objects,
before you release parent objects.
2. Marshal.ReleaseComObject may actually need to be called multiple times,
He suggests calling Marshal.ReleaseComObject multiple times until it returns
zero.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top