RestartDialogEx function (shlobj_core.h)

[This function is available through Windows XP Service Pack 2 (SP2) and Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows.]

Displays a dialog box that asks the user to restart Windows. When the user clicks the button, the function calls ExitWindowsEx to attempt to restart Windows.

Syntax

int RestartDialogEx(
  [in, optional] HWND   hwnd,
  [in, optional] PCWSTR pszPrompt,
                 DWORD  dwReturn,
                 DWORD  dwReasonCode
);

Parameters

[in, optional] hwnd

Type: HWND

A handle to the parent window.

[in, optional] pszPrompt

Type: PCWSTR

A null-terminated string that contains the text that displays in the dialog box to prompt the user.

dwReturn

Type: DWORD

The flags that specify the type of shutdown.

This parameter must include one of the following values.

EWX_LOGOFF

Shuts down all processes running in the security context of the process that called this function. Then logs the user off.

EWX_POWEROFF

Shuts down the system and turns off the power. The system must support the power-off feature. The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see ExitWindowsEx.

EWX_REBOOT

Shuts down the system and then restarts the system. The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see ExitWindowsEx.

EWX_SHUTDOWN

Shuts down the system to a point at which it is safe to turn off the power. At this point, all file buffers have been flushed to disk, and all running processes have stopped. If the system supports the power-off feature, the power is also turned off. The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see ExitWindowsEx.

This parameter can optionally include the following values.

EWX_FORCE

Forces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.

EWX_FORCEIFHUNG

Forces processes to terminate if they do not respond to the WM_QUERYENDSESSION or WM_ENDSESSION message. This flag is ignored if EWX_FORCE is used.

dwReasonCode

Type: DWORD

Windows XP:Specifies the reason for initiating the shutdown. For more information, see System Shutdown Reason Codes.

Windows 2000: This parameter is ignored.

Return value

Type: int

Returns the identifier of the button that was pressed to close the dialog box.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h)
Library Shell32.lib
DLL Shell32.dll (version 5.0 or later)