Hi jasmin,
Where do you show the message box? If you show the message box in the SystemEvents.SessionEnding event handler function, the message box should appear before the full-screen shutdown UI.
static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
{
if (MessageBox.Show("Shuting down...", "Shutting...", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)
== DialogResult.Cancel)
{
e.Cancel = true;
}
}
For more information about the application shutdown changes in Windows Vista/Windows 7, you can refer to this document:
Application Shutdown Changes in Windows Vista http://msdn.microsoft.com/en-us/library/ms700677%28VS.85%29.aspx
Please feel free to let me know if you have any questions or concerns.
Best Regards,
Zhi-Xin
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!