📄 queryint.cpp
字号:
//... IUnknown interface pointer is in variable pIUnknown ...
HRESULT hResult = E_FAIL;
IChihuahua *pIChihuahua = NULL;
// Query the component抯 IChihuahua interface
hResult = pIUnknown->QueryInterface(IID_IChihuahua,
(void**) &pIChihuahua);
// Were we successful?
if (FAILED(hResult))
{
// Determine what went wrong
switch (hResult)
{
// Does the component even support this interface?
case E_NOINTERFACE:
cout << "Component does not expose IChihuahua.\n";
break;
// Has COM been initialized for this thread
case CO_E_NOTINITIALIZED:
cout << "COM not initialized.\n";
break;
// Has the component run out of memory?
case E_OUTOFMEMORY:
cout << "Out of memory!\n";
break;
// Some other error
default:
cout << "Unrecognized error.\n";
}
return hResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -