CComPtr问题~~~~~~~~~~~~ CComPtr<int,CString>abc="ewrewr";MessageBox(abc);怎么程序报错啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ....CComPtr只管理接口的你看看MSDN的例子// Error-checking routine that performs automatic lifetime management// of a COM IErrorInfo object through a CComPtr smart pointer objectHRESULT CheckComError_SmartPtr(){ HRESULT hr; CComBSTR bstrDescription; CComBSTR bstrSource; CComBSTR bstrHelpFile; CComPtr<IErrorInfo> pErrInfo; hr = ::GetErrorInfo(0, &pErrInfo); if(hr != S_OK) return hr; hr = pErrInfo->GetDescription(&bstrDescription); if(FAILED(hr)) return hr; hr = pErrInfo->GetSource(&bstrSource); if(FAILED(hr)) return hr; hr = pErrInfo->GetHelpFile(&bstrHelpFile); if(FAILED(hr)) return hr; return S_OK;} // CComPtr will auto-release underlying IErrorInfo interface pointer as needed API Hook Detours技术 关于MDI初始化问题 网络数据接收后出现乱码? 如何隐藏Resizing风格的对话框的边框,又能使它能够鼠标拖动改变大小??? vc动态链接库连接服务端问题,急急急!!!(海康视频监控软件) 如何在对话框里面加代码? !!在vc6下mfc工程中加入.cpp和.h的问题!! 对话框与视图联系有什么好方法? 如何在OnTimer()内重新设定定时器,50分? 客户端应用如何从组件获取大块数据(几K)? idc_edit 设置值的问题 24位和32位图标的透明显示
CComPtr只管理接口的
你看看MSDN的例子
// Error-checking routine that performs automatic lifetime management
// of a COM IErrorInfo object through a CComPtr smart pointer object
HRESULT CheckComError_SmartPtr()
{
HRESULT hr;
CComBSTR bstrDescription;
CComBSTR bstrSource;
CComBSTR bstrHelpFile; CComPtr<IErrorInfo> pErrInfo;
hr = ::GetErrorInfo(0, &pErrInfo);
if(hr != S_OK)
return hr; hr = pErrInfo->GetDescription(&bstrDescription);
if(FAILED(hr))
return hr; hr = pErrInfo->GetSource(&bstrSource);
if(FAILED(hr))
return hr; hr = pErrInfo->GetHelpFile(&bstrHelpFile);
if(FAILED(hr))
return hr; return S_OK;
} // CComPtr will auto-release underlying IErrorInfo interface pointer as needed