added wxSHUTDOWN_LOGOFF flag, don't use EWX_FORCE by default but only if wxSHUTDOWN_FORCE is specified
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -419,12 +419,14 @@ enum wxKillFlags
|
||||
|
||||
enum wxShutdownFlags
|
||||
{
|
||||
wxSHUTDOWN_POWEROFF, // power off the computer
|
||||
wxSHUTDOWN_REBOOT // shutdown and reboot
|
||||
wxSHUTDOWN_FORCE = 1,// can be combined with other flags (MSW-only)
|
||||
wxSHUTDOWN_POWEROFF = 2,// power off the computer
|
||||
wxSHUTDOWN_REBOOT = 4,// shutdown and reboot
|
||||
wxSHUTDOWN_LOGOFF = 8 // close session (currently MSW-only)
|
||||
};
|
||||
|
||||
// Shutdown or reboot the PC
|
||||
WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags);
|
||||
WXDLLIMPEXP_BASE bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF);
|
||||
|
||||
// send the given signal to the process (only NONE and KILL are supported under
|
||||
// Windows, all others mean TERM), return 0 if ok and -1 on error
|
||||
|
@@ -959,18 +959,22 @@ bool wxShell(const wxString& command = NULL);
|
||||
This function shuts down or reboots the computer depending on the value of
|
||||
the @a flags.
|
||||
|
||||
@note Doing this requires the corresponding access rights (superuser under
|
||||
Unix, SE_SHUTDOWN privilege under Windows NT) and that this function
|
||||
is only implemented under Unix and Win32.
|
||||
@note Note that performing the shutdown requires the corresponding access
|
||||
rights (superuser under Unix, SE_SHUTDOWN privilege under Windows NT)
|
||||
and that this function is only implemented under Unix and MSW.
|
||||
|
||||
@param flags
|
||||
Either wxSHUTDOWN_POWEROFF or wxSHUTDOWN_REBOOT
|
||||
One of @c wxSHUTDOWN_POWEROFF, @c wxSHUTDOWN_REBOOT or
|
||||
@c wxSHUTDOWN_LOGOFF (currently implemented only for MSW) possibly
|
||||
combined with @c wxSHUTDOWN_FORCE which forces shutdown under MSW by
|
||||
forcefully terminating all the applications. As doing this can result
|
||||
in a data loss, this flag shouldn't be used unless really necessary.
|
||||
|
||||
@return @true on success, @false if an error occurred.
|
||||
|
||||
@header{wx/utils.h}
|
||||
*/
|
||||
bool wxShutdown(wxShutdownFlags flags);
|
||||
bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF);
|
||||
|
||||
//@}
|
||||
|
||||
|
@@ -953,7 +953,7 @@ bool wxShell(const wxString& command)
|
||||
}
|
||||
|
||||
// Shutdown or reboot the PC
|
||||
bool wxShutdown(wxShutdownFlags WXUNUSED_IN_WINCE(wFlags))
|
||||
bool wxShutdown(int WXUNUSED_IN_WINCE(flags))
|
||||
{
|
||||
#ifdef __WXWINCE__
|
||||
// TODO-CE
|
||||
@@ -990,15 +990,25 @@ bool wxShutdown(wxShutdownFlags WXUNUSED_IN_WINCE(wFlags))
|
||||
|
||||
if ( bOK )
|
||||
{
|
||||
UINT flags = EWX_SHUTDOWN | EWX_FORCE;
|
||||
switch ( wFlags )
|
||||
UINT wFlags = 0;
|
||||
if ( flags & wxSHUTDOWN_FORCE )
|
||||
{
|
||||
wFlags = EWX_FORCE;
|
||||
flags &= ~wxSHUTDOWN_FORCE;
|
||||
}
|
||||
|
||||
switch ( flags )
|
||||
{
|
||||
case wxSHUTDOWN_POWEROFF:
|
||||
flags |= EWX_POWEROFF;
|
||||
wFlags |= EWX_POWEROFF;
|
||||
break;
|
||||
|
||||
case wxSHUTDOWN_REBOOT:
|
||||
flags |= EWX_REBOOT;
|
||||
wFlags |= EWX_REBOOT;
|
||||
break;
|
||||
|
||||
case wxSHUTDOWN_LOGOFF:
|
||||
wFlags |= EWX_LOGOFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1006,11 +1016,11 @@ bool wxShutdown(wxShutdownFlags WXUNUSED_IN_WINCE(wFlags))
|
||||
return false;
|
||||
}
|
||||
|
||||
bOK = ::ExitWindowsEx(flags, 0) != 0;
|
||||
bOK = ::ExitWindowsEx(wFlags, 0) != 0;
|
||||
}
|
||||
|
||||
return bOK;
|
||||
#endif // Win32/16
|
||||
#endif // WinCE/!WinCE
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user