设置输入法的热键

时间:2010-03-03 17:32:09  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:arametersInfo(UINT uiAction, // system parameter to query or setUINT uiParam, // depends on action to be takenPVOID pvParam, // depends on action to be takenUINT fWinIni // user profile update flag);其中 uiAction有个SPI_SETLANGTOGGLE参数:SPI_SETLANGTOGGLE: Sets the hot key s...
  正文:可以使用SystemParametersInfo这个API,

The SystemParametersInfo function queries or sets systemwide

parameters. This function can also update the user profile

while setting a parameter.

BOOL SystemParametersInfo(

UINT uiAction, // system parameter to query or set

UINT uiParam, // depends on action to be taken

PVOID pvParam, // depends on action to be taken

UINT fWinIni // user profile update flag

);

其中 uiAction有个SPI_SETLANGTOGGLE参数:

SPI_SETLANGTOGGLE: Sets the hot key set for switching between input

languages. The uiParam and pvParam parameters are

not used. The value sets the shortcut keys in the

keyboard property sheets by reading the registry

again. The registry must be set before this flag

is used. the path in the registry is

_CURRENT_USERlayout. Valid

values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT, and

"3" = none.

>>各位能给个简单的例子吗如设置ALT+3为拼音输入法?

uses ..., Registry;

procedure TForm1.Button1Click(Sender: TObject);

var

myReg: TRegistry;

const

buf1: array[0..3] of Byte = ($01, $c0, $00, $00);

buf2: array[0..3] of Byte = ($04, $08, $01, $e0);

buf3: array[0..3] of Byte = ($33, $00, $00, $00);

begin

myReg := TRegistry.Create;

try

myReg.RootKey := HKEY_CURRENT_USER;

if myReg.OpenKey('Control PanelMethodKeys00000100', True) then

begin

myReg.WriteBinaryData('Key Modifiers', buf1, 4);

myReg.WriteBinaryData('Target IME', buf2, 4);

myReg.WriteBinaryData('Virtual Key', buf3, 4);

end;

myReg.CloseKey;

finally

myReg.Free;

end;

end;

重新启动计算机,Alt+3即为全拼输入法的热键。
设置输入法的热键》由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Language/Delphi/13021.html


关键字:

关于《设置输入法的热键》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td