谁给我找来二个读写注册表API函数,说出它们的格式,就有分。。
解决方案 »
- 大家评评,Delphi是不是走到了尽头!
- 我手头上有TVideoCap和TVideoDisp两个控件,请求哪里有它们接口说明的文档?
- 為什麼列印出來的圖像旋轉了180度,高手請進?在線等!!
- 200分求PsFRExportFilters(fastreport导出附加控件),能用马上给分
- 高手请进!在OLEcontainter 控件中所画的图形如何保存到数据库中!
- 怎样知道一个文本文件有多少行?
- 打印问题,请高手一定帮我忙!!!!
- DEPHI初学者问???
- 一个比较幼稚问题,请大侠们提提意见
- 如何判断出某一个目录下到底有多少文件?
- RegisterServiceProcess 函数是在那个单元中声明的?
- 很奇怪的问题,急急?
RegCloseKey
RegCreateKeyEx
RegDeleteKey
RegDeleteValue
在Delphi的帮助里面搜索上面的名称,很详细.
procedure WriteString(const Name, Value : string);
procedure WriteInteger(const Name : string ; Value : Integer);
procedure WriteFloat(const Name : string ; Value : Double);
procedure WriteTime(const Name : string ; Value : TDateTime);
procedure WriteBool(const Name : string ; Value : Boolean);
示例代码:
procedure TForm1.Button1Click(Sender: TObject); var MyReg : TRegistry;
begin
MyReg := TRegistry.Create;
MyReg.RootKey := HKEY_LOCAL_MACHINE;
try
if not MyReg.OpenKey('\SOFTWARE\',FALSE) then
if not MyReg.KeyExists('Passwd') then
MyReg.CreateKey('Passwd');
If not MyReg.OpenKey('\SOFTWARE\Passwd',FALSE) then MyReg.WriteString('pwd1','mypassword1');
MyReg.WriteInteger('pd2',19642);
MyReg.CloseKey;
finally
MyReg.Free;
end;
end;
记得要uses registry
founction ReadString(const Name : string) : string;
founction ReadInteger(const Name : string) : Integer;
founction ReadFloat(const Name : string) : Double;
founction ReadTime(const Name : string) : TdateTime;
founction ReadBool(const Name) : Boolean;
示例程序如下:
procedure TForm1.Button1Click(Sender: TObject); var MyReg : TRegistry;
begin
MyReg := TRegistry.Create;
MyReg.RootKey := HKEY_LOCAL_MACHINE;
try
if not MyReg.OpenKey('\SOFTWARE\',FALSE) then
if not MyReg.KeyExists('Passwd') then
if not MyReg.OpenKey('\SOFTWARE\Passwd',FALSE) then
Label1.Caption := MyReg.ReadString('pwd1');
Label2.Caption := IntToStr(MyReg.ReadInteger('pd2'));
MyReg.CloseKey;
Finally
MyReg.Free;
end;
end;