VB6 - What event is triggered by the X button?

I would like to activate a piece of code in my MDI form when the red X button in the upper right corner is pressed (I do not know what it is officially called) so that the program closes nicely.

What method in the form is called when this happens?

+3
source share
2 answers

Form_QueryUnload. Since you specified the MDI application, the exact event triggered:

Private Sub MDIForm_QueryUnload(cancel As Integer, unloadmode As Integer)

where, if you set cancelto a non-zero value inside this function, it stops exiting the application. In other words, QueryUnloadthis is a way of asking if the form should be unloaded or not. The second argument unloadmodegives you information about how this unloading was started.

MSDN.

+6

Unload QueryUnload MDI

MDI MDI, VB . , Unload QueryUnload MDI . MDI, Unload QueryUnload :

1. MDI QueryUnload

    QueryUnload

   3. Unload

   4. Unload MDI

"" "" , . QueryUnload, Unload , . , , , .

+5

Source: https://habr.com/ru/post/1781836/


All Articles