SetupPromptReboot function (setupapi.h)

[This function is available for use in the operating systems indicated in the Requirements section. It may be altered or unavailable in subsequent versions. SetupAPI should no longer be used for installing applications. Instead, use the Windows Installer for developing application installers. SetupAPI continues to be used for installing device drivers.]

The SetupPromptReboot function asks the user if he wants to reboot the system, optionally dependent on whether any files in a committed file queue were in use during a file operation. If the user answers "yes" to the prompt, shutdown is initiated before this routine returns.


WINSETUPAPI INT SetupPromptReboot(
  [in] HSPFILEQ FileQueue,
  [in] HWND     Owner,
  [in] BOOL     ScanOnly


[in] FileQueue

Optional pointer to a handle to the file queue upon which to base the decision about whether shutdown is necessary. If FileQueue is not specified, SetupPromptReboot assumes shutdown is necessary and asks the user what to do.

[in] Owner

Handle for the parent window to own windows created by this function.

[in] ScanOnly

Indicates whether or not to prompt the user when SetupPromptReboot is called.

If TRUE, the user is never asked about rebooting, and system shutdown is not initiated. In this case, FileQueue must be specified. If FALSE, the user is asked about rebooting, as previously described.

Use ScanOnly to determine if shutdown is necessary separately from actually initiating a shutdown.

Return value

The function returns a combination of the following flags or –1 if an error occurs.

To get extended error information, call GetLastError.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header setupapi.h
Library Setupapi.lib
DLL Setupapi.dll

See also