当前位置: 首页>>代码示例>>C++>>正文


C++ ITfSource类代码示例

本文整理汇总了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;
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:30,代码来源:TextEditSink.cpp

示例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;
}
开发者ID:dbremner,项目名称:Windows-classic-samples,代码行数:25,代码来源:monitor.cpp

示例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;
}
开发者ID:9578577,项目名称:Windows-classic-samples,代码行数:27,代码来源:Compartment.cpp

示例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;
}
开发者ID:9578577,项目名称:Windows-classic-samples,代码行数:56,代码来源:CSI_TextEditSink.cpp

示例5: _UninitThreadFocusSink

void CExtentMonitorTextService::_UninitThreadFocusSink()
{
    ITfSource *pSource;

    if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
    {
        pSource->UnadviseSink(_dwThreadFocusCookie);
        pSource->Release();
    }
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:10,代码来源:ThreadFocusSink.cpp

示例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;
}
开发者ID:deton,项目名称:tsf-tutcode,代码行数:55,代码来源:TextEditSink.cpp

示例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;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:54,代码来源:TextEditSink.cpp

示例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;
}
开发者ID:BuddhismZhang,项目名称:weasel,代码行数:12,代码来源:ThreadMgrEventSink.cpp

示例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;
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:12,代码来源:ThreadFocusSink.cpp

示例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;
}
开发者ID:BuddhismZhang,项目名称:weasel,代码行数:13,代码来源:ThreadMgrEventSink.cpp

示例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;
}
开发者ID:SGA-Takeshi-Tsukamoto,项目名称:corvusskk,代码行数:13,代码来源:CandidateList.cpp

示例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;
	}
}
开发者ID:deton,项目名称:tsf-tutcode,代码行数:15,代码来源:ThreadMgrEventSink.cpp

示例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;
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:15,代码来源:globals.cpp

示例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;
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:15,代码来源:tmgrsink.cpp

示例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;
}
开发者ID:SGA-Takeshi-Tsukamoto,项目名称:corvusskk,代码行数:16,代码来源:CandidateList.cpp


注:本文中的ITfSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。