Solved

Adding a program to Startup

Posted on 1998-06-12
5
282 Views
Last Modified: 2010-08-05
I would like to add a program to the Startup Menu.
Is there an API in Windows which does that.
Can this API be used in WIN95, 98, NT Server and WorkStation.
Is it possible to have this program be the first one in the list of Startup.
Can all the programs in Startup be delayed until this program is completed.

I would appreciate some sample code if possible.

Thanks
0
Comment
Question by:rian
5 Comments
 
LVL 1

Accepted Solution

by:
sfranks earned 100 total points
ID: 1165733
Yes there is an API it is called "copyFileA" located in kernel32

What you would do is copy a shortcut of the program that you want in the startup menu to
the c:\windows\start menu\startup directory in WIN95, in nt you would add it to the
c:\winnt\profiles\"current user"\startup or else the profiles\all users\ or profiles\default user\ directories this would then make the icon appear in the startup menu and be executed upon startup.

As far as it being the first one in the startup menu you would have to give it the highest order name like 1program-name.  

I don't think it is possible to delay the other programs though....  


0
 
LVL 11

Expert Comment

by:alexo
ID: 1165734
Call SHGetSpecialFolderLocation() with the CSIDL_STARTUP argument to get the startup folder location.
0
 

Expert Comment

by:ms99y
ID: 1165735
If you want your program to begin at the start up Also you can write the program name in the registry. If you make a new key into the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" and  register your program name here, Whenever the user log in or restart the PC.Your program automatically executes.

Later
0
 

Author Comment

by:rian
ID: 1165736
Is there an API in C++ to do that
0
 

Expert Comment

by:ms99y
ID: 1165737
To make entry to the registry , you can use the regxxxx  functions in the API. These are RegOpenKey, RegSaveKey, RegCloseKey and so on, once you make the registry entry  your program program will execute without need to write to startup. You can get detailed information and the other functions related from the Win API help

Later
0

Featured Post

Industry Leaders: 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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

713 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