送你一个写注册表的函数的例子:
//-- 前面加上 USES Registry;
procedure WriteRegistString(RootKey:HKEY;Key,Name,Value:String);
var Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := RootKey;
Reg.OpenKey(Key, True);
Reg.WriteString(Name,Value);
finally
Reg.Free;
end;
end;
//---- 下面是调用:-----
WriteRegistString(HKEY_LOCAL_MACHINE, '/Software/MyApp', 'MyRegName', 'MyRegValue');