如何比较 HKL 和字符 []



我有

DWORD dwThreadID = GetCurrentThreadId();
HKL hCurKeyboard = GetKeyboardLayout(dwThreadID);

返回 HKL 当前键盘我需要将其与一些字符进行比较

char defaultLanguage[64]="0x04090409";

如何将 HKL hCurKeyboarddefaultLanguage进行比较

或如何使用此值创建一些 HKL "0x04090409"

        char defaultLanguageLayout[64] = "0x04090409";
        DWORD dwThreadID = GetCurrentThreadId();
        HKL hCurKeyboard = GetKeyboardLayout(dwThreadID);
//->>       if(hCurKeyboard!=defaultLanguageLayout) 
        {
            UINT i;
            HKL hklCurrent;
            UINT uLayouts;
            HKL * lpList;
            uLayouts = GetKeyboardLayoutList(0, NULL);
            lpList = (HKL*) malloc(uLayouts * sizeof(HKL));
            uLayouts = GetKeyboardLayoutList(uLayouts, lpList);
            for(i=0; i<uLayouts; i++)
            {
                hklCurrent = *(lpList + i);
//->>               if(hklCurrent == defaultLanguageLayout){
                    ActivateKeyboardLayout(hklCurrent, 0);
                }
            }

提前谢谢。

根据 http://msdn.microsoft.com/en-us/library/windows/desktop/ms646305(v=vs.85).aspx,最好的办法是:

    HKL defaultLanguageLayout = LoadKeyboardLayout("0x04090409", KLF_SUBSTITUTE_OK);
    DWORD dwThreadID = GetCurrentThreadId();
    HKL hCurKeyboard = GetKeyboardLayout(dwThreadID);
    if(hCurKeyboard!=defaultLanguageLayout) {

但是我对键盘布局的了解还不够,无法知道第二个参数是否正确。

相关内容

  • 没有找到相关文章

最新更新