首页  编辑  

获取键盘布局列表

Tags: /超级猛料/IME.Charset.输入法和中文处理/   Date Created:

获取键盘布局列表

procedure GetKeyboardLayoutLanguages(Strings: TStrings);

var

 Layouts: array of HKL;

 LayoutCount: Integer;

 i: Integer;

begin

 Strings.Clear;

 LayoutCount := GetKeyboardLayoutList(0, Layouts);

 if LayoutCount > 0 then

 begin

   SetLength(Layouts, LayoutCount);

   if GetKeyboardLayoutList(LayoutCount, Layouts[0]) = 0 then

     RaiseLastOSError;

   for i := Low(Layouts) to High(Layouts) do

     Strings.AddObject(

       GetLocaleStr(Layouts[i] and $FFFF, LOCALE_SLANGUAGE, ''),

       TObject(Layouts[i]));

 end else

   RaiseLastOSError;

end;