473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Outlook 2000 Com object in C# doesnt quit

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.ReleaseComO bject(this.email_envoye);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.email_recu);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.emails_envoyes)
;
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.emails_recus);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
this.espace = null;
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.espace);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.inboxFolder);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(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_HostShutdo wn)
{
OnBeginShutdown(ref custom);
}
app = null;
try
{
this.app.Quit();
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
Nov 15 '05 #1
1 2437
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

"palouf" <pa*****@hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
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.ReleaseComO bject(this.email_envoye); }
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.email_recu);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.emails_envoyes) ;
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.emails_recus); }
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
this.espace = null;
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.espace);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(this.inboxFolder);
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(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_HostShutdo wn)
{
OnBeginShutdown(ref custom);
}
app = null;
try
{
this.app.Quit();
}
catch(Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.ToString() );
}

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fritz Switzer | last post by:
Can anyone provide a small snippet in C# that pulls out the Contacts in Outlook XP. I've seen a couple of examples in C++ and VB in previous newsgroup posts, but either the originals didn't work...
3
by: Kurt | last post by:
Hi We are developing an off-the-shelf software suite for a certain business sector. Most of the program is simply a GUI on top of some .mdb files. Its a .net application written in c# One...
4
by: Nathan Carroll | last post by:
Why am I able to use this in Outlook and not do the same from .Net. My problems centers around the Items in the xp version of below i used the interop references. Does something similar exist for...
10
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am...
2
by: John | last post by:
Hi I am using outlook to display and send new mail message from within vb.net. What is the correct way to close outlook after I am done? If I use outlookapp.quit then any running outlook copy...
4
by: msnnews.msn.com | last post by:
hi there, i've got a form that populates a datagrid, and a button that calls a function to export to an excel file. All is well with the export, no errors are returned, but the Excel instance...
3
by: wizzbangca | last post by:
Hi everyone. Having problems with a utility I am writing for work. The previous IT Director thoughtfully allowed 3 (2000, xp, 2003) versions of outlook to be installed rather than 1. Now I need...
23
by: andyoye | last post by:
How can I launch Outlook on users machines when they click a button on a web form (InfoPath)? Thanks
1
by: 1andy1 | last post by:
Hello, I have a following problem. Development environment Windows XP, VS 2008, Outlook 2003. Deployment environment Small bussiness server, Outlook 2000. I have created a small VB .Net program...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.