xp有一個bug,就是在語言設置更改輸入法的默認關閉/打開輸入法的熱鍵CTRL+SPACE後,無法設置恢復到原來的狀態,就是說你必須在CTRL+SHIFT+SPACE和ALT+SHIFT+SPACE中選擇一個新的熱鍵來替換原來的CTRL+SPACE,這給人們帶來了很多不便。用delphi可以快速解決此問題,本人在XP SP2上試驗通過。。方法是先在語言設置裡,去掉啟用按鍵順序。然後編譯運行下面的程序,點btn1那個按鈕就OK了。!
以下是代碼片段:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry;
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
var
reg :TRegistry;
buffer :array[0..3] of Byte;
begin
//setLength(buffer,3);
buffer[0]:= $02;
buffer[1]:=$c0;
buffer[2]:=$00;
buffer[3]:=$00;
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
if(reg.OpenKey('Control PanelInput MethodHot Keys0000010',false)) then
begin
reg.WriteBinaryData('Key Modifiers',buffer,4);
showmessage('ok');
end;
reg.Free;
end;
end.