首页 > 程序开发 > 综合编程 > 安全编程 >

向注册表写入REG_BINARY或REG_DWORD类型的值

2005-05-05

来源:大富翁 //如何向注册表写入REG_BINARY或REG_DWORD类型的值procedure TForm1.Button1Click(Sender: TObject);Const  aBuf : Array[1..24] Of Byte = (00,00,00,00,00,00,00,00,03,00,00,00,00,00,$5b,$e0,00,00,$5c,$e0,00,

来源:大富翁

//如何向注册表写入REG_BINARY或REG_DWORD类型的值
procedure TForm1.Button1Click(Sender: TObject);
Const
aBuf : Array[1..24] Of Byte = (00,00,00,00,00,00,00,00,03,00,00,00,00,00,$5b,$e0,00,00,$5c,$e0,00,00,00,00);
var
Buf : Array[1..24] Of Byte;
Reg : TRegistry;
i : Integer;
begin
For i := 1 To 24 Do
begin
Buf[i] := aBuf[i];
end;
Reg := TRegistry.Create;
Try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey(SYSTEMCurrentControlSetControlKeyboard Layout,True);
Reg.WriteBinaryData(Test, Buf, Sizeof(Buf)); //REG_BINARY
//Reg.WriteInteger(Test, 123); //REG_DWORD
//Reg.WriteTime(Test, Now);
Finally
Reg.CloseKey;
Reg.Free;
End;
end;

相关文章
最新文章
热点推荐