Zitat von
xX0815Xx:
Mit der integrierten Delphi-Hilfe kann ich oftmals nicht viel anfangen
Was kann man damit bitte nicht anfangen:
Zitat:
TRegistry.DeleteKey
Removes a specified key and its associated data from the registry.
function DeleteKey(const Key: String): Boolean;
Description
Call DeleteKey to remove a specified key and its associated data, if any, from the registry.
DeleteKey returns True if key deletion is successful. On error, DeleteKey returns False.
Delphi-Quellcode:
This OnClick event handler deletes all values saved in the registry under they key named in an edit control.
procedure TForm1.Button1Click(Sender: TObject);
var
Reg: TRegistry;
Val:TStringList;
I:Integer;
begin
Reg:=TRegistry.Create;
try
Val:=TStringList.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE; // Section to look for within the registry
if not Reg.OpenKey(Edit1.Text,False) then
ShowMessage('Error opening key')
else
begin
Reg.GetValueNames(Val);
for I:=0 to Val.Count-1 do
begin
ShowMessage(Edit1.Text + Chr(13) +
'has an Entry Called '+Val.Strings[I]+Chr(13)+
'With a Value of '+Reg.ReadString(Val.Strings[I]));
end;
if MessageDlg('Ok to delete the key and lose all these values?'
,Mtinformation,[mbYes,mbNo],0)=mryes then
Reg.DeleteKey(Edit1.Text);
end;
finally
Val.Free;
end;
finally
Reg.Free;
end;
end;