Solved

Automatic run

Posted on 1997-04-30
1
136 Views
Last Modified: 2010-04-04
How can I make my app to run averytime the Windows start. How can I put its icon in the program manager group StartUp, when it is called differently in every language mutation of MS-Windows? Or is there any possibility to add more than one RUN= command into WIN.INI? How?   Thanx, Bocian
0
Comment
Question by:Bocian
1 Comment
 
LVL 1

Accepted Solution

by:
slp earned 100 total points
ID: 1335796
Windows will ignore all but the last RUN= line it encounters in WIN.INI, but more than one program can be started from the RUN= line, they just have to be separated by spaces.  So, you could read in the current line, append your program's name to the line, then write it back out.  Something like :

uses
  IniFiles ;
var
  WININI : TIniFile ;
  S : string ;
begin
  WININI := TIniFile.Create( 'WIN.INI' ) ;
  S := WININI.ReadString( 'WINDOWS', 'RUN', '' ) ;
  S := S + ' MYPROG.EXE' ;
  //        ^ be sure to include a space to separate your
  //       program's name
  WININI.WriteString( 'WINDOWS', 'RUN', S )
  WININI.Free ;
end ;

One error here you may want to trap for here is that .INI file lines cannot be longer than 127 characters (including the label and = sign).

With regard to putting your program into the StartUp group, by default it's called "StartUp" in both Windows3.1x and 95, though there's a PROGMAN.INI setting in Win3.1 that lets you change the name of the startup group (something similar is available in Win95 using the system policy editor).  You should be able to do this pretty reliably with a DDE conversation with the "shell" (Program Manager in 3.1 or the Explorer in 95), I can get some details on that if that's the route you want to go.

HTH

slp

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question