本文整理汇总了C++中CComQIPtr::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::Close方法的具体用法?C++ CComQIPtr::Close怎么用?C++ CComQIPtr::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pDoc
// The open document event handle is the place where the real interface work
// is done.
// Vim gets called from here.
//
HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
if (! g_bEnableVim)
// Vim not enabled or empty command line entered
return S_OK;
// First get the current file name and line number
// Get the document object
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
if (! pDoc)
return S_OK;
BSTR FileName;
long LineNr = -1;
// Get the document name
if (FAILED (pDoc->get_FullName (&FileName)))
return S_OK;
LPDISPATCH pDispSel;
// Get a selection object dispatch pointer
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
{
// Get the selection object
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
if (pSel)
// Get the selection line number
pSel->get_CurrentLine (&LineNr);
pDispSel->Release ();
}
// Open the file in Vim and position to the current line
if (VimOpenFile (FileName, LineNr))
{
if (! g_bDevStudioEditor)
{
// Close the document in developer studio
CComVariant vSaveChanges = dsSaveChangesPrompt;
DsSaveStatus Saved;
pDoc->Close (vSaveChanges, &Saved);
}
}
// We're done here
SysFreeString (FileName);
return S_OK;
}
示例2: OnButtonClicked
virtual STDMETHODIMP OnButtonClicked(IFileDialogCustomize* pfdc, DWORD dwIDCtl)
{
if (dwIDCtl == 101)
{
CComQIPtr<IFileOpenDialog> pDlg = pfdc;
if (pDlg)
{
pDlg->Close(S_OK);
}
}
return S_OK;
}