如何用DELPHI4。0在控制面板上设置输入法的热键?(200分)

  • 主题发起人 主题发起人 心心
  • 开始时间 开始时间
用SystemParametersInfo应该可以。

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
/HKEY_CURRENT_USER/keyboard layout/toggle. Valid
values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT, and
"3" = none.
 
这只是定义了转换键,而不是热键,
待我找找。
 
那就用TRegistry对注册表中的HKEY_CURRENT_USER/Control Panel/Input Method/Hot Keys
下的键进行修改。所有系统安装的输入法及设置都在这里。
 
各位能给个简单的例子吗如设置ALT+3为拼音输入法?
 
附加功能 将问题提前
 
心心:如果还想接着讨论请定期提前自己的帖子,如果不想继续讨论请结束帖子。
 
>>各位能给个简单的例子吗如设置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 Panel/Input Method/Hot Keys/00000100', 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即为全拼输入法的热键。
 
接受答案了.
 
后退
顶部