Re: Start program when Vista starts
- From: Brad Blanchard <nadie137@xxxxxxxxxxx>
- Date: Mon, 23 Jul 2007 12:52:39 +0200
After Googling for a while, I found the Delphi equivalent (see below)
of the function I showed in my previous message. However, this
procedure, like CreateShellLink, also works on XP but on Vista I get a
'Failed to set data for myprog.exe' message. Any advice on how to solve
this issue on Vista will be appreciated.
------------
SetAutoStart(ParamStr(0), 'myprog.exe', True)
procedure SetAutoStart(AppName, AppTitle: string; bRegister: Boolean);
const
RegKey = '\Software\Microsoft\Windows\CurrentVersion\Run';
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;
--------
--
Brad Blanchard
http://www.braser.com
.
- Follow-Ups:
- Re: Start program when Vista starts
- From: Maarten Wiltink
- Re: Start program when Vista starts
- References:
- Start program when Vista starts
- From: Brad Blanchard
- Start program when Vista starts
- Prev by Date: Re: Using LIB Files in Delphi
- Next by Date: Re: Start program when Vista starts
- Previous by thread: Re: Start program when Vista starts
- Next by thread: Re: Start program when Vista starts
- Index(es):
Relevant Pages
|