Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Detect when my application is killed


Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2004, 01:27 PM
akaris akaris is offline
Newcomer
 
Join Date: Apr 2004
Posts: 1
Default Detect when my application is killed


Hi!

I'm trying to detect when my application is killed (End task or process in the Windows Task Manager). If I could detect it, I could end the app normally instead of ""crashing"". Does someone know if it is possible? I've searched pretty much to find something...but found nothing!

Thanks,

- Mike Nadeau
Reply With Quote
  #2  
Old 04-08-2004, 02:21 PM
Glade's Avatar
Glade Glade is offline
Junior Contributor
 
Join Date: Jul 2000
Location: Hamilton, ON, Canada
Posts: 297
Default

Use the QueryUnload event in your main form. It will tell you the UnloadMode. From the help:

Code:
vbFormControlMenu 0 The user chose the Close command from the Control menu on the form. 
vbFormCode 1 The Unload statement is invoked from code. 
vbAppWindows 2 The current Microsoft Windows operating environment session is ending. 
vbAppTaskManager 3 The Microsoft Windows Task Manager is closing the application. 
vbFormMDIForm 4 An MDI child form is closing because the MDI form is closing. 
vbFormOwner 5 A form is closing because its owner is closing.
Reply With Quote
  #3  
Old 04-08-2004, 02:30 PM
Jigo's Avatar
Jigo Jigo is offline
Junior Contributor
 
Join Date: Mar 2004
Location: Manila, PHIL
Posts: 294
Default

Try:

Code:
If App.PrevInstance = True Then 'application is running 'do something Else 'application is not running 'do other End If
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect application focus lost coffee_machine General 1 02-29-2004 01:12 PM
Passing ASP Application Variables to a COM object hominamad Database and Reporting 10 07-10-2003 02:34 AM
EXE keeps running in the task manager even after exiting the application vikjain General 2 06-26-2003 08:07 PM
Help regarding accessing an application on a remote server. FacJoe Communications 3 06-26-2003 01:07 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->