CTextService::CTextService() { DllAddRef(); _cRef = 1; _pThreadMgr = nullptr; _ClientId = TF_CLIENTID_NULL; _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; _dwThreadFocusSinkCookie = TF_INVALID_COOKIE; _dwCompartmentEventSinkOpenCloseCookie = TF_INVALID_COOKIE; _dwCompartmentEventSinkInputmodeConversionCookie = TF_INVALID_COOKIE; _pTextEditSinkContext = nullptr; _dwTextEditSinkCookie = TF_INVALID_COOKIE; _pComposition = nullptr; _pLangBarItem = nullptr; _pLangBarItemI = nullptr; _pCandidateList = nullptr; _pInputModeWindow = nullptr; _gaDisplayAttributeInputMark = 0; _gaDisplayAttributeInputText = 0; _gaDisplayAttributeInputOkuri = 0; _gaDisplayAttributeConvMark = 0; _gaDisplayAttributeConvText = 0; _gaDisplayAttributeConvOkuri = 0; _gaDisplayAttributeConvAnnot = 0; _pD2DFactory = nullptr; _pD2DDCRT = nullptr; for(int i = 0; i < DISPLAY_LIST_COLOR_NUM; i++) { _pD2DBrush[i] = nullptr; } _drawtext_option = D2D1_DRAW_TEXT_OPTIONS_NONE; _pDWFactory = nullptr; _dwActiveFlags = 0; _ImmersiveMode = FALSE; _UILessMode = FALSE; _ShowInputMode = FALSE; hPipe = INVALID_HANDLE_VALUE; inputmode = im_direct; _ResetStatus(); _CreateConfigPath(); _CreateIpcName(); }
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; }