procedure RunOnStartup(
sProgTitle,
sCmdLine : string;
bRunOnce : boolean );
var
sKey : string;
reg : TRegIniFile;
begin
if( bRunOnce )then
sKey := 'Once'
else
sKey := '';
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.WriteString(
'SoftwareMicrosoft'
+ 'WindowsCurrentVersionRun'
+ sKey + #0,
sProgTitle,
sCmdLine );
reg.Free;
end;
sProgTitle,
sCmdLine : string;
bRunOnce : boolean );
var
sKey : string;
reg : TRegIniFile;
begin
if( bRunOnce )then
sKey := 'Once'
else
sKey := '';
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.WriteString(
'SoftwareMicrosoft'
+ 'WindowsCurrentVersionRun'
+ sKey + #0,
sProgTitle,
sCmdLine );
reg.Free;
end;
Listing #1 : Delphi code. Download wstartup (0.38 KB).
- sProgTitle:
- Name of your program. Generally speaking, this could be anything you want.
- sCmdLine:
- This is the full path name to your executable program.
- bRunOnce:
- Set this to True if you want to run your program just once. If this parameter is False, specified program will be executed every time Windows startsup.
RunOnStartup(
'Title of my program',
'MyProg.exe',
False );
'Title of my program',
'MyProg.exe',
False );
Listing #2 : Delphi code. Download demo (0.18 KB).
0 comments:
Post a Comment