473,401 Members | 2,139 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,401 software developers and data experts.

Correct COM clean up??

Hi,

I've no COM experience, and I'm using the following snippet after adding
outlook com module to my references. The code below does the job, so I'm
happy... but also concerned that I'm not getting all cleaned up after the
objects goes out of scope. Do I need any Marchal.ReleaseComObject stuff here??

Outlook.ApplicationClass app = new Outlook.ApplicationClass();

Outlook.MailItemClass mi =
(Outlook.MailItemClass)app.CreateItem(Outlook.OlIt emType.olMailItem);
mi.BodyFormat = Outlook.OlBodyFormat.olFormatPlain;
mi.Body = sb.ToString();
mi.Subject = "Project definition update";
mi.Display(new object());
Nov 17 '05 #1
1 1071
Every time a COM interface pointer enters the common language runtime, it is
wrapped in an runtime callable wrapper, which has the reference count. To
decrement it you have to call Marshal.ReleaseComObject Method ...

--
Vadym Stetsyak aka Vadmyst

"Jesper" <Je****@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
Hi,

I've no COM experience, and I'm using the following snippet after adding
outlook com module to my references. The code below does the job, so I'm
happy... but also concerned that I'm not getting all cleaned up after the
objects goes out of scope. Do I need any Marchal.ReleaseComObject stuff here??
Outlook.ApplicationClass app = new Outlook.ApplicationClass();

Outlook.MailItemClass mi =
(Outlook.MailItemClass)app.CreateItem(Outlook.OlIt emType.olMailItem);
mi.BodyFormat = Outlook.OlBodyFormat.olFormatPlain;
mi.Body = sb.ToString();
mi.Subject = "Project definition update";
mi.Display(new object());

Nov 17 '05 #2

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

Similar topics

8
by: Craig Thomson | last post by:
I was wondering what people do with text provided by the user in a form. Some cleaning needs to be done at some stage if you are going to be putting it in a database or displaying it etc. But when...
1
by: Craig Ringer | last post by:
Hi folks I'm a bit of a newbie here, though I've tried to appropriately research this issue before posting. I've found a lot of questions, a few answers that don't really answer quite what I'm...
7
by: SenderX | last post by:
I am a basically a life-long Win32 C programmer specializing in high-end winsock servers. Before I dive into portable C++ programming, I wanted to code up an example of what I thought would be a...
25
by: rokia | last post by:
in a project, I use many,many stl such as stack,list,vctor etc. somewhere the vector's size is more than 2K. is this a efficient way?
24
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office...
53
by: Alf P. Steinbach | last post by:
So, I got the itch to write something more... I apologize for not doing more on the attempted "Correct C++ Tutorial" earlier, but there were reasons. This is an UNFINISHED and RAW document,...
6
by: VMI | last post by:
What's the correct way of using try...catch in my web application? For example, if I catch a connection error or something with the DB, how am I supposed to bubble it up to the web interface? Is...
3
by: Nick Gilbert | last post by:
Hi, In my VS.NET 2005, if I choose Build Clean Solution, the BIN folder is not touched. Shouldn't it delete all the dll and pdb files in that folder first? Instead, I'm finding I have to do it...
25
by: Koliber (js) | last post by:
sorry for my not perfect english i am really f&*ckin angry in this common pattern about dispose: ////////////////////////////////////////////////////////// Public class...
10
by: Simon | last post by:
As title. How to clean out VSWebCache? Any good way to do that? Thanks.
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.