Link to home
Start Free TrialLog in
Avatar of Jurica2505
Jurica2505

asked on

program runs every time computer starts

How to make that program runs every time computer starts, but not that program or its shortcut is in StartUp in StartMenu?
ASKER CERTIFIED SOLUTION
Avatar of rene100
rene100

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of inthe
inthe

hi,
you use the registry and put program under "run" key,you can do this in a setup/install program like so:

Uses Registry;

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(
    'Software\Microsoft'
    + '\Windows\CurrentVersion\Run'
    + sKey + #0,
    sProgTitle,
    sCmdLine );
  reg.Free;
end;


Usage:
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, your program will be executed every time Windows startsup.
Example:

RunOnStartup( 'Title of my program', 'MyProg.exe', False );
Hi Jurica,

I'm confuse with your questions
http://www1.experts-exchange.com/questions/10322797/How-to-run-programs-before-Windows-opened.html
http://www1.experts-exchange.com/questions/10326634/Execute-programs.html

Grade it first, please. Your image at E-E can be misunderstood.

T++, Radler.
Being Lazy, but take Barry's example......


RunOnStartup( 'Title of my program', 'MyProg.exe', False );

Replace Myprog.exe for this

RunOnStartup( 'Title of my program',paramstr(0), False );

Your program works even if its run off a network, \\whaterver\c\

Its self automatic......
Jurica2505

Was this a delphi question? or a question out of place?.... if it was a delphi question, i think its rather unfair on inthe... if it was not, why did you post it here?...

Craig C.