Var
MyReg: TRegistry;
The begin
MyReg:=TRegistry. Create;
MyReg. RootKey:=HKEY_LOCAL_MACHINE;
If MyReg. KeyExists (' Software \ MyDelphi) then
The begin
If MyReg. CreateKey (' Software \ MyDelphi) then
The begin
If MyReg. OpenKey (' Software \ MyDelphi ', true) then
The begin
MyReg. WriteString (' yjw ', 'yuanjiwu');
end;
end;
End
The else
If MyReg. OpenKey (' Software \ MyDelphi ', true) then
The begin
MyReg. WriteString (' yjw ', 'yuanjiwu');
end;
MyReg. CloseKey;//close the primary key
MyReg. Destroy;//release the memory
end;
CodePudding user response:
Must be an administrator to run the program