Solved

Marshal.ReleaseComObject   use in VB.Net

Posted on 2009-04-08
2
876 Views
Last Modified: 2012-05-06
I am trying to use this:
While xxxxxx <> 0
    System.Runtime.InteropServices.Marshal.ReleaseComObject(xxxxxx)

I am trying to execute this statement just before I exit a COM class.  Is xxxxxx the Com class name?  Can I release it when I am still in it?

Can you provide a while loop where xxxxxx = the com clas name and is the only COM component

 

0
Comment
Question by:garyinmiami2003
2 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 24100646
Unless I am missing something, xxxxxx is a variable holding a reference to your COM object. When in your While loop, you are not "in" the COM. Your COM object exists regardless of your loop. Your loop is saying "keep trying to release (ReleaseComObject) this object until the variable xxxxxx points to 0 and not to a COM object."
0
 

Author Comment

by:garyinmiami2003
ID: 24102156
I would like to clarify a little

Suppose there is a COM Class in a class library and it has been installed on your pc.  The method called in the class begins

Public Function Broker(ByVal extensionData As thirdparty..IFaExtensionData)

(    all kinds of code)


System.Runtime.InteropServices.Marshal.ReleaseComObject(extensionData)

end Function

My question is:  Is this necessary?  Is this the correct way to use it, if it is necessary?






                                       
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now