Here's the Delphi source code for deleting an entry from the Software\Microsoft\Windows\CurrentVersion\Run key, located in the HKEY_LOCAL_MACHINE root key: procedure RemoveFromRunKey(ApTitle: string);
var
Reg: TRegistry;
TheKey: string;
ListOfEntries: TStringList;
i: integer;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
TheKey := 'Software\Microsoft\Windows\CurrentVersion\Run';
// Check if key exist...
// ...if yes, try to delete the entry for ApTitle
if not Reg.OpenKey(TheKey, False) then
ShowMessage('Key not found')
else begin
if Reg.DeleteValue(ApTitle) then
ShowMessage('Removed: ' + ApTitle)
else
ShowMessage('Not found: ' + ApTitle);
end;
Reg.CloseKey;
Reg.Free;
end;
The parameter ApTitle is the title of the application, the
"name" of the
registry entry. This parameter must be the same as what you've set using our
tutorial
Launching an application at Windows Startup.
Example: RemoveFromRunKey('Calculator'); |
|
TOP :: Source
Code and Tutorials :: Crash Course
Delphi :: FAQ
DC Library :: Tips ::
Downloads :: Links
© Copyright 1999-2019
Studiebureau Festraets