[MSUTB][SDK] Implement SetRegisterLangBand (#6471)

Supporting Language Bar...
JIRA issue: CORE-19363
- Add some helper functions.
- Implement SetRegisterLangBand
  function.
This commit is contained in:
Katayama Hirofumi MZ 2024-02-10 16:04:33 +09:00 committed by GitHub
parent 463fec0503
commit 152af475b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 68 additions and 3 deletions

View file

@ -375,6 +375,7 @@ FindEAEnumFontProc(ENUMLOGFONT *pLF, NEWTEXTMETRIC *pTM, INT nFontType, LPARAM l
return FALSE;
}
/// Are there East-Asian vertical fonts?
BOOL CheckEAFonts(void)
{
BOOL bHasVertical = FALSE;
@ -384,6 +385,55 @@ BOOL CheckEAFonts(void)
return bHasVertical;
}
BOOL IsDeskBandFromReg()
{
if (!(g_dwOSInfo & CIC_OSINFO_XPPLUS)) // Desk band is for XP+
return FALSE;
CicRegKey regKey;
if (regKey.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")))
{
DWORD dwValue = 0;
regKey.QueryDword(TEXT("ShowDeskBand"), &dwValue);
return !!dwValue;
}
return FALSE;
}
void SetDeskBandToReg(BOOL bShow)
{
CicRegKey regKey;
if (regKey.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\"), KEY_ALL_ACCESS))
regKey.SetDword(TEXT("ShowDeskBand"), bShow);
}
BOOL RegisterComCat(REFCLSID rclsid, REFCATID rcatid, BOOL bRegister)
{
if (FAILED(::CoInitialize(NULL)))
return FALSE;
ICatRegister *pCat;
HRESULT hr = ::CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER,
IID_ICatRegister, (void**)&pCat);
if (SUCCEEDED(hr))
{
if (bRegister)
hr = pCat->RegisterClassImplCategories(rclsid, 1, const_cast<CATID*>(&rcatid));
else
hr = pCat->UnRegisterClassImplCategories(rclsid, 1, const_cast<CATID*>(&rcatid));
pCat->Release();
}
::CoUninitialize();
//if (IsIE5())
// ::RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("Component Categories\\{00021492-0000-0000-C000-000000000046}\\Enum"));
return SUCCEEDED(hr);
}
BOOL InitFromReg(void)
{
DWORD dwValue;
@ -4801,13 +4851,26 @@ GetPopupTipbar(HWND hWnd, BOOL fWinLogon)
/***********************************************************************
* SetRegisterLangBand (MSUTB.@)
*
* @unimplemented
* @implemented
*/
EXTERN_C HRESULT WINAPI
SetRegisterLangBand(BOOL bRegister)
{
FIXME("stub:(%d)\n", bRegister);
return E_NOTIMPL;
TRACE("(%d)\n", bRegister);
if (!(g_dwOSInfo & CIC_OSINFO_XPPLUS)) // Desk band is for XP+
return E_FAIL;
BOOL bDeskBand = IsDeskBandFromReg();
if (bDeskBand == bRegister)
return S_OK;
SetDeskBandToReg(bRegister);
if (!RegisterComCat(CLSID_MSUTBDeskBand, CATID_DeskBand, bRegister))
return TF_E_NOLOCK;
return S_OK;
}
/***********************************************************************

View file

@ -15,6 +15,8 @@ DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63, 0xB2F0, 0x4784, 0x8B,
DEFINE_GUID(CLSID_SYSTEMLANGBARITEM, 0xBEBACC94, 0x5CD3, 0x4662, 0xA1, 0xE0, 0xF3, 0x31, 0x99, 0x49, 0x36, 0x69);
DEFINE_GUID(IID_ITfLangBarMgr_P, 0xD72C0FA9, 0xADD5, 0x4AF0, 0x87, 0x06, 0x4F, 0xA9, 0xAE, 0x3E, 0x2E, 0xFF);
DEFINE_GUID(IID_ITfLangBarEventSink_P, 0x7A460360, 0xDA21, 0x4B09, 0xA8, 0xA0, 0x8A, 0x69, 0xE7, 0x28, 0xD8, 0x93);
DEFINE_GUID(CLSID_MSUTBDeskBand, 0x540D8A8B, 0x1C3F, 0x4E32, 0x81, 0x32, 0x53, 0x0F, 0x6A, 0x50, 0x20, 0x90);
DEFINE_GUID(CATID_DeskBand, 0x00021492, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
EXTERN_C LPVOID WINAPI GetLibTls(VOID);
EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon);