Home > Back-end >  Delphi xe 10 operating win10 registry is not successful, who know the reason?
Delphi xe 10 operating win10 registry is not successful, who know the reason?

Time:09-24

Procedure TFrmMain. FormCreate (Sender: TObject);
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
  • Related