Solved

Continue Setup after reboot

Posted on 1999-01-06
1
221 Views
Last Modified: 2010-04-02
In my setup I am checking for some system components..If they are not there I spawn the setup for that component - which asks the user to reboot their machine - when it returns I would like to continue with my setup program.  Any ideas on how to do that?
0
Comment
Question by:gpaige
1 Comment
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1181653
When the user shuts down the system with your application’s window open, you may optionally store information in the registry so that the application’s state is restored when the user starts up Windows. (The system does this for folders.) To have your application’s state restored, store your window and application state information under its registry entries when the system notifies your application that it is shutting down. Store the state information in your application’s entries under HKEY_CURRENT_USER and add a value name–value pair to the RunOnce subkey that corresponds to your application. When the user restarts the system, it runs the command line you supply. Once your application runs, you can use the data you stored to restore its state.

HKEY_CURRENT_USER
    Software
        Microsoft
            Windows
                CurrentVersion
                    RunOnce application identifier = command line
 
If you have multiple instances open, you can include value name entries for each or consolidate them as a single entry and use command-line switches that are most appropriate for your application. For example, you can include entries like the following.

  WordPad Document 1 = C:\Program Files\Wordpad.exe Letter to Bill /restore
  WordPad Document 2 = C:\Program Files\Wordpad.exe Letter to Paul /restore
  Paint = C:\Program Files\Paint.exe Abstract.bmp Cubist.bmp
 
As long as you provide a valid command-line string that your application can process, you can format the entry in a way that best fits your application.

You can also include a RunOnce entry under the HKEY_LOCAL_ MACHINE key. When using this entry, however, the system runs the application before starting up. You can use this entry for applications that may need to query the user for information that affects how Windows starts. Just remember that any entry here will affect all users of the computer.

RunOnce entries are automatically removed from the registry once the system starts up. Therefore, you need not remove or update the entries, but your application must always save its state when the user shuts down the system. The system also supports a Run subkey in both the HKEY_CURRENT_USER and HKEY_LOCAL_ MACHINE keys. The system runs any value name entries under this subkey after the system starts up, but does not remove those entries from the registry. For example, a virus check program can be installed to run automatically after the system starts up. You can also support this functionality by placing a file or shortcut to a file in the Startup folder. The registry stores the location of the Startup folder, as a value in HKEY_CURRENT_USER\Software\Microsoft\ Windows\CurrentVersion\Explorer\Shell Folders.

Also see http://support.microsoft.com/support/kb/articles/q137/3/67.asp
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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 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.
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.

932 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

16 Experts available now in Live!

Get 1:1 Help Now