Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Adding a program to Startup

Posted on 1998-06-12
5
Medium Priority
?
286 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 400 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

916 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