dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jun 29, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Application Termination

Question:
I have a message box that comes up to warn the user that they are terminating the application as it normally should be left running. I want to know how to stop that message if the machine is performing a shutdown. At the moment the event is fired every time. I have the event in the form.unload event of the main form so I can cancel the unload if the user does not want to close the application.

Answer:
Use the QueryUnload event, it has a parameter called unloadMode which tells you why the app is being shut down. The following are the possible values.

vbFormControlMenu: The user clicked the Close button on the Control menu on the form.
vbFormCode: The Unload statement is called from code.
vbAppWindows: The current Windows session is ending.
vbAppTaskManager: The Task Manager is closing the application.
vbFormMDIForm: An MDI child form is closing because the MDI parent form is closing.
vbFormOwner: A form is closing because its owner form is closing (owner is new to vb6, a form's owner is specified as the Owner argument of the Show method).

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date