Could QueryInterface() provide us with nullptr when succeed? [duplicate]
问题 This question already has answers here : Handling CoCreateInstance return value (2 answers) Closed 5 years ago . Imagine a situation: CComPtr<IGraphBuilder> pGraph; HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGraph)); if (SUCCEEDED(hr)) { CComPtr<IMediaControl> pControl; hr = pGraph->QueryInterface(IID_PPV_ARGS(&pControl)); if(SUCCEEDED(hr)) {...} } I wonder, if pControl could ever be nullptr inside last block {...} . The question occurred,