ID: Q193362
The information in this article applies to:
- Windows 95
- Windows 98
The SDK documentation states that SetupPromptReboot() is being supported on Windows NT, Windows 95, and Windows 98. However, SetupPromptReboot() does not work correctly under Windows 95 or Windows 98. Under Windows 95 or Windows 98, a call to SetupPromptReboot() returns the following error message:
You must quit this program before you quit Windows.
Click OK to quit the program and Windows, or click Cancel to continue
running the program and Windows.
When you click OK the application does not immediately terminate, but a
window appears with the option to End Task after a few moments. If you
choose to End Task, you reset your computer. This behavior is consistent
for version 4.0 of the Setupapi.dll, and the behavior might change with
newer versions of Setupapi.dll.
NOTE: SetupPromptReboot() works correctly under Windows NT.
If you have a Setup API application that runs under a Windows 95 or Windows 98 computer, do not use SetupPromptReboot(). Instead, use the sample code in the article listed below.
For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q168690
TITLE : HOWTO: Programmatically Force a Log off on Windows 95/98
NOTE: Pass the flag EWX_REBOOT rather than EWX_LOGOFF in the function
ExitWindowsEx(). The function call will appear as:
ExitWindowsEx(EWX_REBOOT , 0)
This restarts the computer instead of logging off.
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
1. Create a new console application.
2. Add a file to the project, such as MyBoot.C.
3. Add the following sample code:
#include <windows.h> // Includes basic windows functionality.
#include <setupapi.h> // Includes the SetupAPI.
#pragma comment(lib,"SetupAPI.lib") //Inform linker to use SetupAPI.
main()
{
SetupPromptReboot(0,0,FALSE);
return 0;
}
4. Compile and run the program on a Windows 95 or Windows 98 computer.
Additional query words:
Keywords : kbAPI kbWinOS95 kbWinOS98
Issue type : kbbug
Solution Type : kbpending
Last Reviewed: April 23, 1999