Board index » delphi » How to start a program when Windows Start ??

How to start a program when Windows Start ??

Well, there's the win.ini "load=" and "run=" lines (or is it
system.ini, I can never remember).

HTH,
Scott

Quote
Eric wrote in message <374593A1.F906E...@yahoo.com>...
>Hello,

>Is it possible to automatic start a program when Windows 95/98 start
?
>I know if we put the program in the Registry/RUN, or put it in
StartUp
>Folder it will  automatic start when Windows start.

>But, if I don't want to put it in Registry/RUN or put it in Startup
>folder, can it also automatic startup when Windows95/98 start ???

>Best regards,
>Eric

 

Re:How to start a program when Windows Start ??


How will it know that it a) exists b) can run itself
and how will it run itself anyways?

--

Please visit one of my homepages: http://www.mp3.com/rawlyn or
http://www.mp3.com/mcp

Quote
Eric wrote in message <374593A1.F906E...@yahoo.com>...
>Hello,

>Is it possible to automatic start a program when Windows 95/98 start ?
>I know if we put the program in the Registry/RUN, or put it in StartUp
>Folder it will  automatic start when Windows start.

>But, if I don't want to put it in Registry/RUN or put it in Startup
>folder, can it also automatic startup when Windows95/98 start ???

>Best regards,
>Eric

Re:How to start a program when Windows Start ??


Doesn't
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
have anything to do with that (btw. key is from the head and probably wrong,
there's some runservices key somewhere though)

HTH

  Roel

In comp.lang.pascal.delphi.misc Eric <eric...@yahoo.com> wrote:

Quote
> Hello,
> Is it possible to automatic start a program when Windows 95/98 start ?
> I know if we put the program in the Registry/RUN, or put it in StartUp
> Folder it will  automatic start when Windows start.
> But, if I don't want to put it in Registry/RUN or put it in Startup
> folder, can it also automatic startup when Windows95/98 start ???
> Best regards,
> Eric

Re:How to start a program when Windows Start ??


Hello,

Is it possible to automatic start a program when Windows 95/98 start ?
I know if we put the program in the Registry/RUN, or put it in StartUp
Folder it will  automatic start when Windows start.

But, if I don't want to put it in Registry/RUN or put it in Startup
folder, can it also automatic startup when Windows95/98 start ???

Best regards,
Eric

Re:How to start a program when Windows Start ??


You got the key right.

anything in this key is run after windows has loaded but before any login
events.  anything in the Run key is loaded after login events

Regards

Dan Donoghue
DSoft Computer Software

Quote
Roel Spapens wrote in message <7i4mr6...@news.tue.nl>...
>Doesn't
>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
>have anything to do with that (btw. key is from the head and probably
wrong,
>there's some runservices key somewhere though)

>HTH

>  Roel

>In comp.lang.pascal.delphi.misc Eric <eric...@yahoo.com> wrote:
>> Hello,

>> Is it possible to automatic start a program when Windows 95/98 start ?
>> I know if we put the program in the Registry/RUN, or put it in StartUp
>> Folder it will  automatic start when Windows start.

>> But, if I don't want to put it in Registry/RUN or put it in Startup
>> folder, can it also automatic startup when Windows95/98 start ???

>> Best regards,
>> Eric

Re:How to start a program when Windows Start ??


Eric <eric...@yahoo.com> kirjoitti viestiss?:374593A1.F906E...@yahoo.com...
Quote
> But, if I don't want to put it in Registry/RUN or put it in Startup
> folder, can it also automatic startup when Windows95/98 start ???

Yes, put it in win.ini
--
M.S.

Re:How to start a program when Windows Start ??


This is from the Borland.com Frequently Asked Questions
http://www.borland.com/devsupport/delphi/qanda/
===================
Question and Answer Database

    FAQ1894D.txt   Running apps on Windows startup
    Category   :Windows API
    Platform    :All
    Product    :All 32 bit

    Question:
    How can I get my application to run every time Windows starts?

    Answer:
    The following demonstrates how to add your application to the
    Windows boot sequence. Code is demonstrated for both the Win32 and
    Win16 platforms.

    uses
      Registry, {For Win32}
      IniFiles; {For Win16}

    {$IFNDEF WIN32}
      const MAX_PATH = 144;
    {$ENDIF}

    {For Win32}
    procedure TForm1.Button1Click(Sender: TObject);
    var
      reg: TRegistry;
    begin
      reg := TRegistry.Create;
      reg.RootKey := HKEY_LOCAL_MACHINE;
      reg.LazyWrite := false;
      reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',
                  false);
      reg.WriteString('My App', Application.ExeName);
      reg.CloseKey;
      reg.free;
    end;

    {For Win16}
    procedure TForm1.Button2Click(Sender: TObject);
    var
      WinIni : TIniFile;
      WinIniFileName : array[0..MAX_PATH] of char;
      s : string;
    begin
      GetWindowsDirectory(WinIniFileName, sizeof(WinIniFileName));
      StrCat(WinIniFileName, '\win.ini');
      WinIni := TIniFile.Create(WinIniFileName);
      s := WinIni.ReadString('windows',
                             'run',
                             '');
      if s = '' then
        s := Application.ExeName else
        s := s + ';' + Application.ExeName;
      WinIni.WriteString('windows',
                         'run',
                         s);
      WinIni.Free;
    end;

===================
Hope this helps!

--  All the best from James Sandbrook.
****************************************************************
http://ssapcs.interspeed.net/index.html
Charlie Calvert talks about Delphi's future
HTML-New Zealand Web Site Links-Family-Delphi-Pascal-
School Projects-Computer Terms-Interviews with Dr Bob
and Marco Cant - And our Delphi e-group.
****************************************************************

Quote
Eric wrote:
> Hello,

> Is it possible to automatic start a program when Windows 95/98 start ?
> I know if we put the program in the Registry/RUN, or put it in StartUp
> Folder it will  automatic start when Windows start.

> But, if I don't want to put it in Registry/RUN or put it in Startup
> folder, can it also automatic startup when Windows95/98 start ???

> Best regards,
> Eric

Re:How to start a program when Windows Start ??


Also,

If you want to do some error / status checking before you run your program,
then create a program that does that checking for you and start THAT program
for the win.ini.  If that program says all is well then it can call your main
program.  If not, it can display a nice, fiendly error message.

Re:How to start a program when Windows Start ??


Quote
Eric wrote in message <374593A1.F906E...@yahoo.com>...
>Hello,

>Is it possible to automatic start a program when Windows 95/98 start ?
>I know if we put the program in the Registry/RUN, or put it in StartUp
>Folder it will  automatic start when Windows start.

>But, if I don't want to put it in Registry/RUN or put it in Startup
>folder, can it also automatic startup when Windows95/98 start ???

>Best regards,
>Eric

I see you got a few valid ways of doing this, but let me ask you this.  Why
would you want to hide the fact that a program is running when windows
starts?  Unless it is a program that absolutely needs to run before anything
else, it may seem a little deceptive.

Re:How to start a program when Windows Start ??


Quote
> >Hello,

> >Is it possible to automatic start a program when Windows 95/98 start ?
> >I know if we put the program in the Registry/RUN, or put it in StartUp
> >Folder it will  automatic start when Windows start.

> >But, if I don't want to put it in Registry/RUN or put it in Startup
> >folder, can it also automatic startup when Windows95/98 start ???

> >Best regards,
> >Eric

win.ini

Re:How to start a program when Windows Start ??


You can also use the one method not known to many in your system ini file on
a windows 95/98 platform you have

Quote
>shell=Explorer.exe

it may not have Explorer.exe depending on whether the system has a different
shell loading, but if you replace that with

shell=Explorer.exe your_app_path/name.exe

it will run on windows load up.

Good Luck

Other Threads