I made this little code to stop the closing of the application.
Public Sub New()
InitializeComponent()
AddHandler SystemEvents.SessionEnding, AddressOf SessionEndingEvtHandler
End Sub
Private Sub SessionEndingEvtHandler(sender As Object, e As SessionEndingEventArgs)
MessageBox.Show("Cancelling Windows shutdown")
e.Cancel = True
End Sub
It works fine, the application doesn't close anymore. But when I try to shutdown the system (Windows 8) a fullscreened prompt appears, with my application listed on it, and asking me to confirm the shutdown or cancel it.
My question is, how can I Cancel the shutdown ?
I tried to activate the cancel button (detail on this screen link) with :
SendKeys.Send("{ENTER}")
But it doesn't work
Any idea how to simulate the cancel button action ?
Thanks, i apologise for my english, i'm french.
shutdown -f
to force the shutdown.