deadlykitten
Programmer
hello, i have an application, and i put a shortcut to it inside win+startup folder, and all is ok.
Now i wish to change this approach, by coding it, and so i have used the code listed at the bottom of this post.
The code inputs a key inside HKLM, but there is a windows error when system starts :
This error is similar on 3 different computers, running win xp or win 7.
Please, i would apreciate a bit of help kindly !
procedure SetAutoStart(AppName, AppTitle: string; bRegister: Boolean);
const RegKey = '\Software\Microsoft\Windows\CurrentVersion\Run'; // Run or RunOnce
var Registry: TRegistry;
begin
Registry := TRegistry.Create;
try Registry.RootKey := HKEY_LOCAL_MACHINE;
if Registry.OpenKey(RegKey, False)
then begin
if bRegister = False then Registry.DeleteValue(AppTitle)
else Registry.WriteString(AppTitle, AppName);
end;
finally Registry.Free;
end;
end;
Now i wish to change this approach, by coding it, and so i have used the code listed at the bottom of this post.
The code inputs a key inside HKLM, but there is a windows error when system starts :
This error is similar on 3 different computers, running win xp or win 7.
Please, i would apreciate a bit of help kindly !
procedure SetAutoStart(AppName, AppTitle: string; bRegister: Boolean);
const RegKey = '\Software\Microsoft\Windows\CurrentVersion\Run'; // Run or RunOnce
var Registry: TRegistry;
begin
Registry := TRegistry.Create;
try Registry.RootKey := HKEY_LOCAL_MACHINE;
if Registry.OpenKey(RegKey, False)
then begin
if bRegister = False then Registry.DeleteValue(AppTitle)
else Registry.WriteString(AppTitle, AppName);
end;
finally Registry.Free;
end;
end;