?
Solved

Automatic run

Posted on 1997-04-30
1
Medium Priority
?
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
slp earned 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

800 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