예제 #1
0
STDAPI CTextService::ActivateEx(ITfThreadMgr *ptim, TfClientId tid, DWORD dwFlags)
{
	//_wsetlocale(LC_ALL, L"JPN");

	_CreateConfigPath();
	
	_pThreadMgr = ptim;
	_pThreadMgr->AddRef();
	_ClientId = tid;
	
	if(!_InitThreadMgrEventSink())
	{
		goto exit;
	}

	if(!_InitCompartmentEventSink())
	{
		goto exit;
	}

	if(!_InitLanguageBar())
	{
		goto exit;
	}

	if(!_InitKeyEventSink())
	{
		goto exit;
	}

	_LoadPreservedKey();

	if(!_InitPreservedKey())
	{
		goto exit;
	}

	if(!_InitFunctionProvider())
	{
		goto exit;
	}

	_SetKeyboardOpen(TRUE);
	_KeyboardOpenCloseChanged();

	return S_OK;

exit:
	Deactivate();
	return E_FAIL;
}
예제 #2
0
STDAPI CTextService::ActivateEx(ITfThreadMgr *ptim, TfClientId tid, DWORD dwFlags)
{
	_pThreadMgr = ptim;
	_pThreadMgr->AddRef();
	_ClientId = tid;

	if (!_IsKeyboardOpen())
	{
		_KeyboardSetDefaultMode();
	}

	if(!_InitThreadMgrEventSink())
	{
		goto exit;
	}

	if(!_InitThreadFocusSink())
	{
		goto exit;
	}

	if(!_InitCompartmentEventSink())
	{
		goto exit;
	}

	{
		ITfDocumentMgr* pDocumentMgr = nullptr;
		if (SUCCEEDED(_pThreadMgr->GetFocus(&pDocumentMgr)) && (pDocumentMgr != nullptr))
		{
			_InitTextEditSink(pDocumentMgr);
			SafeRelease(&pDocumentMgr);
		}
	}

	if(!_InitLanguageBar())
	{
		goto exit;
	}

	if(!_InitKeyEventSink())
	{
		goto exit;
	}

	if(!_InitDisplayAttributeGuidAtom())
	{
		goto exit;
	}

	if(!_InitFunctionProvider())
	{
		goto exit;
	}

	_KeyboardOpenCloseChanged(FALSE);

	return S_OK;

exit:
	Deactivate();
	return E_FAIL;
}