本文整理汇总了C++中ITfSource::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ ITfSource::Release方法的具体用法?C++ ITfSource::Release怎么用?C++ ITfSource::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITfSource
的用法示例。
在下文中一共展示了ITfSource::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _InitTextEditSink
BOOL CSampleIME::_InitTextEditSink(_In_ ITfDocumentMgr *pDocMgr)
{
ITfSource* pSource = nullptr;
BOOL ret = TRUE;
// clear out any previous sink first
if (_textEditSinkCookie != TF_INVALID_COOKIE)
{
if (SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource)))
{
pSource->UnadviseSink(_textEditSinkCookie);
pSource->Release();
}
_pTextEditSinkContext->Release();
_pTextEditSinkContext = nullptr;
_textEditSinkCookie = TF_INVALID_COOKIE;
}
if (pDocMgr == nullptr)
{
return TRUE; // caller just wanted to clear the previous sink
}
if (FAILED(pDocMgr->GetTop(&_pTextEditSinkContext)))
{
return FALSE;
}
if (_pTextEditSinkContext == nullptr)
{
return TRUE; // empty document, no sink possible
}
ret = FALSE;
if (SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource)))
{
if (SUCCEEDED(pSource->AdviseSink(IID_ITfTextEditSink, (ITfTextEditSink *)this, &_textEditSinkCookie)))
{
ret = TRUE;
}
else
{
_textEditSinkCookie = TF_INVALID_COOKIE;
}
pSource->Release();
}
if (ret == FALSE)
{
_pTextEditSinkContext->Release();
_pTextEditSinkContext = nullptr;
}
return ret;
}
示例2: _InitTextEditSink
BOOL CTextService::_InitTextEditSink(ITfDocumentMgr *pDocMgr)
{
ITfSource *pSource;
BOOL fRet;
// clear out any previous sink first
if (_dwTextEditSinkCookie != TF_INVALID_COOKIE)
{
if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->UnadviseSink(_dwTextEditSinkCookie);
pSource->Release();
}
_pTextEditSinkContext->Release();
_pTextEditSinkContext = NULL;
_dwTextEditSinkCookie = TF_INVALID_COOKIE;
}
if (pDocMgr == NULL)
return TRUE; // caller just wanted to clear the previous sink
// setup a new sink advised to the topmost context of the document
if (pDocMgr->GetTop(&_pTextEditSinkContext) != S_OK)
return FALSE;
if (_pTextEditSinkContext == NULL)
return TRUE; // empty document, no sink possible
fRet = FALSE;
if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
if (pSource->AdviseSink(IID_ITfTextEditSink, (ITfTextEditSink *)this, &_dwTextEditSinkCookie) == S_OK)
{
fRet = TRUE;
}
else
{
_dwTextEditSinkCookie = TF_INVALID_COOKIE;
}
pSource->Release();
}
if (fRet == FALSE)
{
_pTextEditSinkContext->Release();
_pTextEditSinkContext = NULL;
}
return fRet;
}
示例3: _InitThreadMgrEventSink
BOOL WeaselTSF::_InitThreadMgrEventSink()
{
ITfSource *pSource;
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **) &pSource) != S_OK)
return FALSE;
if (pSource->AdviseSink(IID_ITfThreadMgrEventSink, (ITfThreadMgrEventSink *) this, &_dwThreadMgrEventSinkCookie) != S_OK)
{
_dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
pSource->Release();
return FALSE;
}
pSource->Release();
return TRUE;
}
示例4: _Unadvise
HRESULT CTextEditSink::_Unadvise()
{
HRESULT hr;
ITfSource *source = NULL;
hr = E_FAIL;
if (_pic == NULL)
goto Exit;
if (FAILED(_pic->QueryInterface(IID_ITfSource, (void **)&source)))
goto Exit;
if (FAILED(source->UnadviseSink(_dwEditCookie)))
goto Exit;
hr = S_OK;
Exit:
if (source)
source->Release();
if (_pic)
{
_pic->Release();
_pic = NULL;
}
return hr;
}
示例5: Uninitialize
HRESULT CCompartmentMonitor::Uninitialize(void)
{
HRESULT hr = S_OK;
if(m_pCompartment)
{
ITfSource *pSource;
hr = m_pCompartment->QueryInterface(IID_ITfSource, (void **)&pSource);
if(SUCCEEDED(hr))
{
hr = pSource->UnadviseSink(m_dwCookie);
pSource->Release();
}
m_pCompartment->Release();
m_pCompartment = NULL;
}
m_guidCompartment = GUID_NULL;
return hr;
}
示例6: _Advise
HRESULT CCompartmentEventSink::_Advise(_In_ IUnknown *punk, _In_ REFGUID guidCompartment)
{
HRESULT hr = S_OK;
ITfCompartmentMgr* pCompartmentMgr = nullptr;
ITfSource* pSource = nullptr;
hr = punk->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompartmentMgr);
if (FAILED(hr))
{
return hr;
}
hr = pCompartmentMgr->GetCompartment(guidCompartment, &_pCompartment);
if (SUCCEEDED(hr))
{
hr = _pCompartment->QueryInterface(IID_ITfSource, (void **)&pSource);
if (SUCCEEDED(hr))
{
hr = pSource->AdviseSink(IID_ITfCompartmentEventSink, this, &_dwCookie);
pSource->Release();
}
}
pCompartmentMgr->Release();
return hr;
}
示例7: _UninitThreadFocusSink
void CIME::_UninitThreadFocusSink()
{
ITfSource* pSource = nullptr;
if (FAILED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource)))
{
return;
}
if (FAILED(pSource->UnadviseSink(_dwThreadFocusSinkCookie)))
{
pSource->Release();
return;
}
pSource->Release();
}
示例8: _UninitThreadFocusSink
void CExtentMonitorTextService::_UninitThreadFocusSink()
{
ITfSource *pSource;
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->UnadviseSink(_dwThreadFocusCookie);
pSource->Release();
}
}
示例9: _InitThreadFocusSink
BOOL CIME::_InitThreadFocusSink()
{
ITfSource* pSource = nullptr;
if (FAILED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource)))
{
return FALSE;
}
if (FAILED(pSource->AdviseSink(IID_ITfThreadFocusSink, (ITfThreadFocusSink *)this, &_dwThreadFocusSinkCookie)))
{
pSource->Release();
return FALSE;
}
pSource->Release();
return TRUE;
}
示例10: _UninitThreadMgrEventSink
void WeaselTSF::_UninitThreadMgrEventSink()
{
ITfSource *pSource;
if (_dwThreadMgrEventSinkCookie == TF_INVALID_COOKIE)
return;
if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **) &pSource)))
{
pSource->UnadviseSink(_dwThreadMgrEventSinkCookie);
pSource->Release();
}
_dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
}
示例11: _InitThreadFocusSink
BOOL CExtentMonitorTextService::_InitThreadFocusSink()
{
ITfSource *pSource;
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->AdviseSink(IID_ITfThreadFocusSink, (ITfThreadFocusSink *)this, &_dwThreadFocusCookie);
pSource->Release();
}
return TRUE;
}
示例12: _UninitThreadMgrSink
void CCaseTextService::_UninitThreadMgrSink()
{
ITfSource *pSource;
if (_dwThreadMgrEventSinkCookie == TF_INVALID_COOKIE)
return; // never Advised
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->UnadviseSink(_dwThreadMgrEventSinkCookie);
pSource->Release();
}
_dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
}
示例13: UnadviseSink
void UnadviseSink(IUnknown *pSourceIn, DWORD *pdwCookie)
{
ITfSource *pSource;
if (*pdwCookie == TF_INVALID_COOKIE)
return; // never Advised
if (pSourceIn->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->UnadviseSink(*pdwCookie);
pSource->Release();
}
*pdwCookie = TF_INVALID_COOKIE;
}
示例14: _UninitActiveLanguageProfileNotifySink
void COVTSF::_UninitActiveLanguageProfileNotifySink()
{
ITfSource* pSource = nullptr;
if (_activeLanguageProfileNotifySinkCookie == TF_INVALID_COOKIE)
{
return; // never Advised
}
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->UnadviseSink(_activeLanguageProfileNotifySinkCookie);
pSource->Release();
}
_activeLanguageProfileNotifySinkCookie = TF_INVALID_COOKIE;
}
示例15: _UninitThreadMgrEventSink
void CSampleIME::_UninitThreadMgrEventSink()
{
ITfSource* pSource = nullptr;
if (_threadMgrEventSinkCookie == TF_INVALID_COOKIE)
{
return;
}
if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource)))
{
pSource->UnadviseSink(_threadMgrEventSinkCookie);
pSource->Release();
}
_threadMgrEventSinkCookie = TF_INVALID_COOKIE;
}