Handling CoCreateInstance return value

后端 未结 2 563
后悔当初
后悔当初 2021-01-19 14:15

Here\'s a code sample creating a COM object:

CComPtr pFilter;
auto hr = CoCreateInstance(CLSID_DMOWrapperFilter, NULL,
    CLSCTX_INPROC_S         


        
2条回答
  •  一整个雨季
    2021-01-19 14:59

    I think it is redundant and not needed to check both.

    If it does fail though, the return value will tell you which error occurred. That's why there's 2 ways of determining if the function succeeded or not.

提交回复
热议问题