With some older C ++ code trying to use Com DL, it works fine when DLL is registered Goes, but it crahses if DLL is not registered.
// COM start HRESULT hr = CoInitialize (NULL);
IGetTestPtr ptest (__ uuidof (tester));
"Use method from dll"
// Uninstall COM CoUninitialize ();
Before calling on IGetTestPtr ptest (__ uuidof (tester)) to check whether DLL is registered?
Or what is the right way to stop the accident?
Your object can be successfully tested for HRESULT returning:
< Code> IGetTestPtr p = null; HRESULT hRes = P. Create Instance (__Widoff (Tester)); Bool BSUVP = SUCCEEDED (HRS);
It assumes that you have created the interface wrapper around your Type Library using Visual Studio, where COM Smart Pointers are used in the interface (this gives you the CreateInstance method).
Comments
Post a Comment