Solved

Adding a program to Startup

Posted on 1998-06-12
5
279 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now