` Printed Icetips Article

Icetips Article



COM: Uninitalizing COM objects 3
2004-01-18 -- Andy Ireland
 
Newsgroups: softvelocity.public.clarion6

Hi Carl,

> > When I looked an the CComInitter Destruct method it does not appear to call
> > CoUNinit if S_False was returned for the CoInit.
>
> It's a bug then.

My current code is correct so it's a left over bug from a long time ago.
There are quite a few bugs in the old code that were fixed years ago. My
current code is....

PWCOMIniter.Construct procedure

  code
  compile('_PWU_', _PWUtil_)
    CoUninitialize()
    CoFreeAllLibraries()
    self.hr = CoInitializeEx(0, COINIT_MULTITHREADED)
  _PWU_
  omit('_PWU_', _PWUtil_)
    self.hr = CoInitialize(0)
  _PWU_
    if self.hr = S_FALSE or self.hr = S_OK
      self.hr = S_OK
      self.fInitialised = true
    end


PWCOMIniter.Destruct procedure

  code
    if self.fInitialised
      CoUninitialize()
      self.fInitialised = false
    end


Regards

Andy



Printed November 23, 2024, 3:44 am
This article has been viewed/printed 35376 times.
Google search has resulted in 5 hits on this article since January 25, 2004.