[MSUTB][SDK] Implement DoCloseLangbar (#6423)

Supporting Language Bar...
JIRA issue: CORE-19363
- Implement GetGlobalCompartment function.
- Implement GetGlobalCompartmentDWORD and
  SetGlobalCompartmentDWORD helper functions.
- Implement TurnOffSpeechIfItsOn and
  DoCloseLangbar functions.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-31 12:21:09 +09:00 committed by GitHub
parent 934cd46df5
commit 1311537435
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 82 additions and 6 deletions

View File

@ -35,6 +35,85 @@ class CCicLibMenuItem;
class CTipbarAccItem;
class CUTBMenuItem;
HRESULT GetGlobalCompartment(REFGUID rguid, ITfCompartment **ppComp)
{
ITfCompartmentMgr *pCompMgr = NULL;
HRESULT hr = TF_GetGlobalCompartment(&pCompMgr);
if (FAILED(hr))
return hr;
if (!pCompMgr)
return E_FAIL;
hr = pCompMgr->GetCompartment(rguid, ppComp);
pCompMgr->Release();
return hr;
}
HRESULT GetGlobalCompartmentDWORD(REFGUID rguid, LPDWORD pdwValue)
{
*pdwValue = 0;
ITfCompartment *pComp;
HRESULT hr = GetGlobalCompartment(rguid, &pComp);
if (SUCCEEDED(hr))
{
VARIANT vari;
hr = pComp->GetValue(&vari);
if (hr == S_OK)
*pdwValue = V_I4(&vari);
pComp->Release();
}
return hr;
}
HRESULT SetGlobalCompartmentDWORD(REFGUID rguid, DWORD dwValue)
{
VARIANT vari;
ITfCompartment *pComp;
HRESULT hr = GetGlobalCompartment(rguid, &pComp);
if (SUCCEEDED(hr))
{
V_VT(&vari) = VT_I4;
V_I4(&vari) = dwValue;
hr = pComp->SetValue(0, &vari);
pComp->Release();
}
return hr;
}
void TurnOffSpeechIfItsOn(void)
{
DWORD dwValue = 0;
HRESULT hr = GetGlobalCompartmentDWORD(GUID_COMPARTMENT_SPEECH_OPENCLOSE, &dwValue);
if (SUCCEEDED(hr) && dwValue)
SetGlobalCompartmentDWORD(GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0);
}
void DoCloseLangbar(void)
{
ITfLangBarMgr *pLangBarMgr = NULL;
HRESULT hr = TF_CreateLangBarMgr(&pLangBarMgr);
if (FAILED(hr))
return;
if (pLangBarMgr)
{
hr = pLangBarMgr->ShowFloating(8);
pLangBarMgr->Release();
pLangBarMgr = NULL;
}
if (SUCCEEDED(hr))
TurnOffSpeechIfItsOn();
CicRegKey regKey;
LSTATUS error = regKey.Open(HKEY_CURRENT_USER,
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
KEY_ALL_ACCESS);
if (error == ERROR_SUCCESS)
::RegDeleteValue(regKey, TEXT("ctfmon.exe"));
}
/***********************************************************************/
class CUTBLangBarDlg
@ -511,12 +590,6 @@ STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::DoModal(HWND hDlg)
return TRUE;
}
/// @unimplemented
void DoCloseLangbar(void)
{
//FIXME
}
STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))

View File

@ -28,6 +28,7 @@
#include "resource.h"
#include <cicero/cicreg.h>
#include <cicero/cicutb.h>
#include <cicero/cicuif.h>
#include <wine/debug.h>

View File

@ -7,6 +7,8 @@
#pragma once
DEFINE_GUID(GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0x544D6A63, 0xE2E8, 0x4752, 0xBB, 0xD1, 0x00, 0x09, 0x60, 0xBC, 0xA0, 0x83);
EXTERN_C LPVOID WINAPI GetLibTls(VOID);
EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon);
EXTERN_C HRESULT WINAPI SetRegisterLangBand(BOOL bRegister);