Hi

> > Don't forget that CoInitialize() starts the COM runtime for the
> > thread, not the current scope (although they often end up being the
> > same thing).
>
> OK, consider this:
>
>  int main()
>  {
>   CoInitialize( NULL );
>   CComPtr< IX > pX;
>   pX.CoCreateInstance( CLSID_X );
>   CoUninitialize(); // bummer!
>  }
>
> Do you see my point?  If not, try to imagine when CComPtr's dtor is
executed.

No, no, no. That's not what I was saying at all. What I meant was this:

class COMInit
{
...
}

int main()
{
  COMInit comInit;
  CComPtr< IX > pX;
  pX.CoCreateInstance( CLSID_X );
 }

The thing I was complaining about was you global instance of COMInit.

It's unnecessary and globals are evil. :-)

Regards
Paul

Paul Grenyer
Email: [EMAIL PROTECTED]
Web: http://www.paulgrenyer.co.uk

Have you met Aeryn: http://www.paulgrenyer.co.uk/aeryn?



Reply via email to