` Uninitalizing COM objects 1 (Carl Barnes) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

COM: Uninitalizing COM objects 1
2004-01-17 -- Carl Barnes
 
Newsgroups: softvelocity.public.clarion6 MSDN on CoInitilize says the following: "Typically, the COM library is initialized on a thread only once. Subsequent calls to CoInitialize or CoInitializeEx on the same thread will succeed, as long as they do not attempt to change the concurrency model, but will return S_FALSE. To close the COM library gracefully, each successful call to CoInitialize or CoInitializeEx, including those that return S_FALSE, must be balanced by a corresponding call to CoUninitialize." When I looked an the CComInitter Destruct method it does not appear to call CoUNinit if S_False was returned for the CoInit. Also does CoInit really need to be called per thread? MSDN clearly says it does, but the book "Inside COM" says per Process. CCOMIniter.Construct procedure code self.hr = CoInitialize() if self.hr = S_FALSE self.fAlreadyInitialised = true self.hr = S_OK end if self.hr = S_OK if ~self.fAlreadyInitialised self.fInitialised = true. end CCOMIniter.Destruct procedure code if self.fInitialised if ~self.fAlreadyInitialised CoUninitialize(). self.fInitialised = false end


Today is November 21, 2024, 3:41 am
This article has been viewed 35377 times.
Google search has resulted in 29 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: