Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following example uses the ExitWindows function to log off the current user.
// Log off the current user.
ExitWindows(0, 0);
The following example uses the ExitWindowsEx function to log off the current user.
// Log off the current user.
ExitWindowsEx(EWX_LOGOFF, 0);
The application receives the WM_QUERYENDSESSION message and displays a dialog box asking whether it is OK to end the session. If the user clicks Yes, the system logs off the user. If the user clicks No, the logoff is canceled.
// Process the message in the window procedure.
case WM_QUERYENDSESSION:
{
int r;
r = MessageBox(NULL,(LPCWSTR)L"End the session?",(LPCWSTR)L"WM_QUERYENDSESSION",MB_YESNO);
// Return TRUE to continue, FALSE to stop.
return r == IDYES;
break;
}
Related topics