Solved

Automatic run

Posted on 1997-04-30
1
151 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
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: …

724 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