Solved

Adding a program to Startup

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

710 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