Open GoogleCodeExporter opened 9 years ago
Прошу прощения, что продублировал уже
известные проблемы. Ниже быстрая и
некрасивая заплатка, исправляющая это.
tstring layoutLangId(HKL layout) {
TCHAR buf[KL_NAMELENGTH];
swprintf(buf, KL_NAMELENGTH, TEXT("%08X"), layout);
return tstring(buf);
}
tstring layoutLanguage(HKL layout) {
TCHAR langNameBuffer[KL_NAMELENGTH]; langNameBuffer[0] = 0;
if (LOWORD((DWORD)layout) == HIWORD((DWORD)layout))
layout = (HKL)LOWORD((DWORD)layout);
swprintf(langNameBuffer, KL_NAMELENGTH, TEXT("%08X"), layout);
DWORD keyNameBufferSize = 256;
TCHAR keyNameBuffer[256]; keyNameBuffer[0] = 0;
swprintf(keyNameBuffer, keyNameBufferSize, TEXT("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s"), langNameBuffer);
HKEY hkResult = 0;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyNameBuffer, 0, KEY_READ, &hkResult)) {
keyNameBufferSize = sizeof(TCHAR) * keyNameBufferSize;
RegQueryValueEx(hkResult, TEXT("Layout Text"), NULL, NULL, (LPBYTE)&keyNameBuffer, &keyNameBufferSize);
RegCloseKey(hkResult);
}
return tstring(keyNameBuffer);
}
Original comment by kreli...@gmail.com
on 21 Sep 2011 at 7:21
Original issue reported on code.google.com by
kreli...@gmail.com
on 20 Sep 2011 at 7:51