"class not registered", which class?

Consider this code:

try {
    ISomeObject pObj(__uuidof(SomeClass));
    ISomeObject pObj2(__uuidof(SomeOtherClass));
} catch ( _com_error& e ) {
    // Log what failed
}

those. I have a block of code that initializes my objects. Sometimes (poor installation) it does not work because some class has not been properly registered. (I have no specific problem, but rather a general discussion here.)

Is there any way, from the caught exception or otherwise, to understand which class failed? A thought to make their own packaging, which stores a variable like gLastCreateAttemptUuid, but it seems cumbersome.

Also, suppose that SomeClass, in turn, is trying to create something else that is not registered. Can I then find out the main problem?

+3
source share
3

CoCreateInstance() , - ATL, Native COM Support .

, , CreateInstance() - , . HRESULT , .

ypu, , . Process Monitor , .

0

CComPtr::CreateInstance nor _com_ptr_t::CreateInstance , . HRESULT.

HRESULT , , ( ).

try {
    ISomeObject pObj, pObj2;
    HRESULT hr1 = pObj.CreateInstance(__uuidof(SomeClass));
    HRESULT hr2 = pObj2.CreateInstance(__uuidof(SomeOtherClass));
} catch ( _com_error& e ) {
    // Log what failed
}

CoCreateInstance .

: , , , , . , , , , . try/catch , , .

+1

CoCreateInstance(), , , ProgID CLSID. , CLSID , , . , IID . :: StringFromGUID2() GUID.

, - . Sharptooth ProcessMonitor ( RegMon).

0

Source: https://habr.com/ru/post/1709592/


All Articles