本文整理汇总了C++中CComQIPtr::FindConnectionPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::FindConnectionPoint方法的具体用法?C++ CComQIPtr::FindConnectionPoint怎么用?C++ CComQIPtr::FindConnectionPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::FindConnectionPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
HRESULT CPolyCommand::initialize()
{
HRESULT hr = S_OK;
try {
// Get an instance of a wrapper for a non-db-resident polygon
if (FAILED(hr = m_pPoly.CoCreateInstance(CLSID_ComPolygon))) {
// most likely problem, be a little more descriptive here
acutPrintf("\nUnable to load ComPolygon");
throw hr;
}
// Get the base object - needed for those methods inherited by polygon
m_pBaseObj = m_pPoly;
m_pBaseObj->CreateObject();
// Get an instance of a listner so we know when input has been
// entered in OPM
if (FAILED(hr = CComObject<CComPolyCmd>::CreateInstance(&m_pPolyCmd)))
throw hr;
m_pPolyCmd->SetDocument(curDoc());
hr = m_pPolyCmd->QueryInterface(IID_IUnknown,(LPVOID *)&m_pUnkCmd);
if (FAILED(hr))
throw hr;
// Attach the listener to the polygon wrapper
CComQIPtr<IConnectionPointContainer> pPtContainer;
pPtContainer = m_pPoly;
hr = pPtContainer->FindConnectionPoint(
IID_IPropertyNotifySink,&m_pConPt);
if (FAILED(hr))
throw hr;
if (FAILED(hr = m_pConPt->Advise(m_pUnkCmd,&m_dConnectionID)))
throw hr;
acedSetIUnknownForCurrentCommand(m_pPoly);
m_pDb = curDoc()->database();
setDefaults();
} catch (HRESULT) {
fail();
}
return hr;
}
示例2: Exception
void IISxpressAPI::ResponseHistory::AttachConnectionPoint()
{
m_dwCookie = 0;
m_pHTTPNotifyCP = nullptr;
if (m_pNotifyObj == nullptr)
{
// TODO: a better error message here
throw gcnew System::Exception();
}
CComPtr<IIISxpressHTTPRequest> pHTTPRequest;
HRESULT hr = GetHTTPRequest(&pHTTPRequest);
if (hr != S_OK)
{
throw gcnew IISxpressAPI::IISxpressAPIException(hr);
}
CComQIPtr<IConnectionPointContainer> pConnPointCont = pHTTPRequest;
if (pConnPointCont != NULL)
{
if (pConnPointCont != NULL)
{
CComPtr<IConnectionPoint> pHTTPNotifyCP;
HRESULT hr = pConnPointCont->FindConnectionPoint(IID_IIISxpressHTTPNotify, &pHTTPNotifyCP);
if (pHTTPNotifyCP != NULL)
{
CComPtr<IUnknown> pUnk;
m_pNotifyObj->QueryInterface(IID_IUnknown, (void**) &pUnk);
DWORD dwCookie = 0;
hr = pHTTPNotifyCP->Advise(pUnk, &dwCookie);
m_pHTTPNotifyCP = pHTTPNotifyCP.Detach();
m_dwCookie = dwCookie;
}
}
}
}