2008. augusztus 8., péntek

Switch Keyboard for your application


Problem/Question/Abstract:

Switch Keyboard for your application

Answer:

Solve 1:

Following code will activate 'Greek' Keyboard Layout for the application.

var
  LangIdentifier: string;
begin
  LangIdentifier := '00000408'; //'0000408' is the Language Identifier for Greek
  LoadKeyboardLayout(PChar(LangIdentifier), KLF_ACTIVATE);
end;

PS: This would only Load the Keyboard Layouts which are installed on that very machine otherwise there would be no affect.


Solve 2:

If you want to change a current keyboard layout, you can:

1

var
  lang: HKL;
  lang := LoadKeyboardLayout(pcKeyboard, 0);
  SetActiveKeyboardLayout(lang);

2

LoadKeyboardLayout(pcKeyboard, KLF_ACTIVATE);

where pcKeyboard is:

'00000409' - english
'00000419' - russian
'00000422' - ukrainian
'00000407' - german
'0000040C' - french
'00000410' - italian
'00000416' - portuguese
'0000040A' - spanish

... (for more information view a language consts in windows.pas)

Nincsenek megjegyzések:

Megjegyzés küldése