BOOL CDIME::_UpdateLanguageBarOnSetFocus(_In_ ITfDocumentMgr *pDocMgrFocus) { debugPrint(L"_UpdateLanguageBarOnSetFocus()"); BOOL needDisableButtons = FALSE; if (!pDocMgrFocus) { needDisableButtons = TRUE; } else { IEnumTfContexts* pEnumContext = nullptr; if (FAILED(pDocMgrFocus->EnumContexts(&pEnumContext)) || !pEnumContext) { needDisableButtons = TRUE; } else { ULONG fetched = 0; ITfContext* pContext = nullptr; if (FAILED(pEnumContext->Next(1, &pContext, &fetched)) || fetched != 1) { needDisableButtons = TRUE; } if (pContext == nullptr) { // context is not associated needDisableButtons = TRUE; } else { pContext->Release(); } } if (pEnumContext) { pEnumContext->Release(); } } SetLanguageBarStatus(TF_LBI_STATUS_DISABLED, needDisableButtons); return needDisableButtons; }
void CIME::_UpdateLanguageBarOnSetFocus(_In_ ITfDocumentMgr *pDocMgrFocus) { BOOL needDisableButtons = FALSE; if (!pDocMgrFocus) { needDisableButtons = TRUE; } else { IEnumTfContexts* pEnumContext = nullptr; if (FAILED(pDocMgrFocus->EnumContexts(&pEnumContext)) || !pEnumContext) { needDisableButtons = TRUE; } else { ULONG fetched = 0; ITfContext* pContext = nullptr; if (FAILED(pEnumContext->Next(1, &pContext, &fetched)) || fetched != 1) { needDisableButtons = TRUE; } if (!pContext) { // context is not associated needDisableButtons = TRUE; } else { pContext->Release(); } } if (pEnumContext) { pEnumContext->Release(); } } CCompositionProcessorEngine* pCompositionProcessorEngine = nullptr; pCompositionProcessorEngine = _pCompositionProcessorEngine; pCompositionProcessorEngine->SetLanguageBarStatus(TF_LBI_STATUS_DISABLED, needDisableButtons); }