本文整理汇总了C++中ITfSource类的典型用法代码示例。如果您正苦于以下问题:C++ ITfSource类的具体用法?C++ ITfSource怎么用?C++ ITfSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ITfSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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;
}
示例2: 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;
}
示例3: _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;
}
示例4: _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;
}
示例5: _UninitThreadFocusSink
void CExtentMonitorTextService::_UninitThreadFocusSink()
{
ITfSource *pSource;
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
{
pSource->UnadviseSink(_dwThreadFocusCookie);
pSource->Release();
}
}
示例6: SafeRelease
BOOL CTextService::_InitTextEditSink(ITfDocumentMgr *pDocumentMgr)
{
BOOL fRet = FALSE;
if(_pTextEditSinkContext != nullptr && _dwTextEditSinkCookie != TF_INVALID_COOKIE)
{
ITfSource *pSource = nullptr;
if(SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr))
{
pSource->UnadviseSink(_dwTextEditSinkCookie);
SafeRelease(&pSource);
}
SafeRelease(&_pTextEditSinkContext);
_dwTextEditSinkCookie = TF_INVALID_COOKIE;
}
if(pDocumentMgr == nullptr)
{
return TRUE;
}
if(FAILED(pDocumentMgr->GetTop(&_pTextEditSinkContext)))
{
return FALSE;
}
if(_pTextEditSinkContext == nullptr)
{
return TRUE;
}
{
ITfSource *pSource = nullptr;
if(SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr))
{
if(SUCCEEDED(pSource->AdviseSink(IID_IUNK_ARGS((ITfTextEditSink *)this), &_dwTextEditSinkCookie)))
{
fRet = TRUE;
}
else
{
_dwTextEditSinkCookie = TF_INVALID_COOKIE;
}
SafeRelease(&pSource);
}
}
if(fRet == FALSE)
{
SafeRelease(&_pTextEditSinkContext);
}
return fRet;
}
示例7: _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;
}
示例8: _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;
}
示例9: _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;
}
示例10: _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;
}
return TRUE;
}
示例11: _AdviseContextKeyEventSink
HRESULT CCandidateList::_AdviseContextKeyEventSink()
{
HRESULT hr = E_FAIL;
ITfSource *pSource;
if(_pContextCandidateWindow->QueryInterface(IID_PPV_ARGS(&pSource)) == S_OK)
{
hr = pSource->AdviseSink(IID_IUNK_ARGS((ITfContextKeyEventSink *)this), &_dwCookieContextKeyEventSink);
SafeRelease(&pSource);
}
return hr;
}
示例12: _UninitThreadMgrEventSink
void CTextService::_UninitThreadMgrEventSink()
{
HRESULT hr;
if(_dwThreadMgrEventSinkCookie != TF_INVALID_COOKIE)
{
ITfSource *pSource = nullptr;
if(SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr))
{
hr = pSource->UnadviseSink(_dwThreadMgrEventSinkCookie);
SafeRelease(&pSource);
}
_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: _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;
}
示例15: _UnadviseContextKeyEventSink
HRESULT CCandidateList::_UnadviseContextKeyEventSink()
{
HRESULT hr = E_FAIL;
ITfSource *pSource;
if(_pContextCandidateWindow != NULL)
{
if(_pContextCandidateWindow->QueryInterface(IID_PPV_ARGS(&pSource)) == S_OK)
{
hr = pSource->UnadviseSink(_dwCookieContextKeyEventSink);
SafeRelease(&pSource);
}
}
return hr;
}