Application Termination

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).

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved