下面是Screen.GetImes私有方法的代码,自己拷贝过去写一个函数自己用把。<br>function TScreen.GetImes: TStrings;<br>const<br> KbLayoutRegkeyFmt = 'System/CurrentControlSet/Control/Keyboard Layouts/%.8x'; // do not localize<br> KbLayoutRegSubkey = 'layout text'; // do not localize<br>var<br> TotalKbLayout, I, Bufsize: Integer;<br> KbList: array[0..63] of HKL;<br> qKey: HKey;<br> ImeFileName: array [Byte] of Char;<br> RegKey: array [0..63] of Char;<br>begin<br> if FImes = nil then<br> begin<br> FImes := TStringList.Create;<br><br> FDefaultIme := '';<br> TotalKbLayout := GetKeyboardLayoutList(64, KbList);<br><br> for I := 0 to TotalKbLayout - 1 do<br> begin<br> if Imm32IsIME(KbList) then<br> begin<br> if RegOpenKeyEx(HKEY_LOCAL_MACHINE,<br> StrFmt(RegKey, KbLayoutRegKeyFmt, [KbList]), 0, KEY_READ,<br> qKey) = ERROR_SUCCESS then<br> try<br> Bufsize := sizeof(ImeFileName);<br> if RegQueryValueEx(qKey, KbLayoutRegSubKey, nil, nil,<br> @ImeFileName, @Bufsize) = ERROR_SUCCESS then<br> begin<br> FImes.AddObject(ImeFileName, TObject(KbList));<br> if KbList = FDefaultKbLayout then<br> FDefaultIme := ImeFileName;<br> end;<br> finally<br> RegCloseKey(qKey);<br> end;<br> end;<br> end;<br> TStringList(FImes).Duplicates := dupIgnore;<br> TStringList(FImes).Sorted := TRUE;<br> end;<br> Result := FImes;<br>end;