Turn off the computer OSVERSIONINFO OsVersionInfo; // data structure contains the operating system version information OsVersionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); GetVersionEx (& OsVersionInfo); // Get OS version information if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {// Windows98, Call the exitWindowSex () function Restart the computer dword dwreserved; exitwindowsex (ewx_reboot, dwreserved); // can change the first parameter, implement the operation of the user, // shut down, turn off the power, etc.
// some processing prior to exiting}
Restart computer typef int (int); // Show Shutter Hinstance Hinst = LoadLibrary ("shell32.dll"); // Load shell32.dllshutdowndlg shutdowndialog; // point to shell32.dll library The pointer IF (Hinst! = NULL) {// get the function of the shutdown dialog function and calls shutdowndialog = (ShutDowndialog) (* shutdowndialog) (0); (0);}