[RESOLVED] Close application when computer is shutting down...
I have written an application that sits in the systray and monitors a database for me. The problem is that this application is stopping some of my clients computers from shutting down, I assume because the app is still running when the computer is trying to shut down.
What I need to know is if there is a way that my application can tell when the computer is shutting down, so that I can close my application and therefore allow the computer to shut down.
I am only running my app on Windows O/S e.g. 2000, XP
The application is written in VS 2005, .NET 2 and VB.Net language
Anyway help would be really apreshiated
Thanks in advance
Simon
Re: Close application when computer is shutting down...
Of course, in the WindowClosing event.
Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Select Case e.CloseReason
Case CloseReason.UserClosing
MinimizeMeToTray()
Case CloseReason.WindowsShutDown
Me.Close()
Case Else
Me.Close()
End Select
End Sub
Re: Close application when computer is shutting down...
Jenner,
Thanks, this was exacually what I needed.
Simon