本文整理汇总了C++中CComQIPtr::ActivateObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::ActivateObject方法的具体用法?C++ CComQIPtr::ActivateObject怎么用?C++ CComQIPtr::ActivateObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::ActivateObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMDIActivate
LRESULT CDTDViewGroup::OnMDIActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
HWND hwndChildDeact = (HWND) wParam; // child being deactivated
HWND hwndChildAct = (HWND) lParam; // child being activated
HWND hwnd;
get_hwnd(&hwnd);
BOOL bActivate = (hwnd == hwndChildAct);
CComQIPtr<IUIManager> uiManager = gIFrame;
if (bActivate)
{
//CComPtr<IDocumentsClass> documentsClass;
//m_pDocument->GetDocumentsClass(&documentsClass);
uiManager->ActivateObject(NULL/*documentsClass*/, m_pDocument->GetUnknown());
uiManager->ActivateObject(m_pDocument->GetUnknown(), GetUnknown());
// uiManager->ActivateObject(m_viewGroup->GetUnknown(), GetUnknown());
}
CUIMDIChildImpl<CDTDViewGroup>::OnMDIActivate(uMsg, wParam, lParam, bHandled);
if (!bActivate)
{
// uiManager->DeactivateObject(GetUnknown());
uiManager->DeactivateObject(GetUnknown());
uiManager->DeactivateObject(m_pDocument->GetUnknown());
}
return 0;
}
示例2: Run
STDMETHODIMP CPageDesignerApp::Run(long *result)
{
CComObject<CPageDesignerFrame>::CreateInstance(&m_frame);
m_frame->AddRef();
gIFrame = m_frame;
if (m_frame->CreateEx() == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
m_frame->ShowWindow(SW_SHOW/*nCmdShow*/);
CComQIPtr<IUIManager> uiManager = m_frame;
/*
CComPtr<IUnknown> pThis;
QueryInterface(IID_IUnknown, (void**)&pThis);
*/
uiManager->ActivateObject(NULL, GetUnknown());
*result = 0;
return S_OK;
}
示例3: OnFileNew
//.........这里部分代码省略.........
pDocument->NewDocument(); // Init (?)
pDocument->CreatePages(dlg.m_numPages);
pDocument->ShowViews();
// CComQIPtr<IUIManager> uiManager = m_frame;
// CComQIPtr<IPDDocument> document = pDocument;
// CComPtr<IUnknown> _this;
// QueryInterface(IID_IUnknown, (void**)&_this);
//uiManager->ActivateObject(GetUnknown(), document);
}
}
#if 0
HINSTANCE hLib = LoadLibrary("C:\\mmsx\\mmstudioplugins\\DOMCOREMOD.dll");
if (hLib)
{
HTMLModalDialogProc HTMLModalDialog = (HTMLModalDialogProc)GetProcAddress(hLib, "HTMLModalDialog");
if (HTMLModalDialog)
{
CComQIPtr<IDOMDocument> xmldoc;
xmldoc.CoCreateInstance(CLSID_LDocument);
xmldoc->put_async(VARIANT_FALSE);
VARIANT_BOOL success;
xmldoc->loadXML(L"<newdocument/>", &success);
CComQIPtr<IDOMElement> element;
xmldoc->get_documentElement(&element);
WCHAR buf[64];
swprintf(buf, L"%d", 1);
element->setAttribute(L"pagesnum", buf);
swprintf(buf, L"%d", 1);
element->setAttribute(L"columnsnum", buf);
swprintf(buf, L"%dpt", 1);
element->setAttribute(L"columnsgutter", buf);
_variant_t arg = (IDispatch*)element.p;
_variant_t result;
HTMLModalDialog(GetMainHwnd(), L"C:\\MMStudio\\pd_newdocument.html", &arg, L"", &result);
CComObject<CPDDocument>* pDocument;
CComObject<CPDDocument>::CreateInstance(&pDocument);
if (pDocument)
{
pDocument->AddRef();
pDocument->NewDocument(); // Init (?)
pDocument->m_pageWidth = 200;
pDocument->m_pageHeight = 400;
pDocument->CreatePages(4);
pDocument->ShowViews();
CComQIPtr<IUIManager> uiManager = m_frame;
CComQIPtr<IPDDocument> document = pDocument;
CComPtr<IUnknown> _this;
QueryInterface(IID_IUnknown, (void**)&_this);
uiManager->ActivateObject(_this, document);
}
}
else
{
MessageBox(GetMainHwnd(), "Couldn't find proc", "PageDesigner", MB_OK);
}
FreeLibrary(hLib);
}
else
{
MessageBox(GetMainHwnd(), "Couldn't load library", "PageDesigner", MB_OK);
}
#endif
#if 0
CComObject<CESvgDocument>* pDocument;
CComObject<CESvgDocument>::CreateInstance(&pDocument);
pDocument->AddRef();
if (pDocument != NULL)
{
pDocument->NewDocument();
pDocument->ShowViews();
CComPtr<IUnknown> unk;
pDocument->QueryInterface(IID_IUnknown, (void**)&unk);
m_frame->ActivateObject(unk);
}
#endif
return 0;
}