|
-
Mar 17th, 2009, 06:33 AM
#1
Thread Starter
Addicted Member
[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
Last edited by Hack; Mar 17th, 2009 at 01:17 PM.
Reason: Added RESOLVED to thread title and green resolve checkmark
-
Mar 17th, 2009, 07:34 AM
#2
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
-
Mar 17th, 2009, 08:05 AM
#3
Thread Starter
Addicted Member
Re: Close application when computer is shutting down...
Jenner,
Thanks, this was exacually what I needed.
Simon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|