Home > Back-end >  Why there is no code in window close button click event form can also be closed
Why there is no code in window close button click event form can also be closed

Time:09-16

When I click the close button, an empty form event handling process can be closed without add code how form

CodePudding user response:

Windows system to judge the mouse to click position is a close button, sends WM_CLOSE message to the application, the application of the default processing of the message is closed form,

CodePudding user response:

This is the Form of (VCL) code, and closed the Windows related code, execute the Form the Close of the event, also can send the appropriate message to the system, the system is closed related to the Form,

CodePudding user response:

reference 1st floor u010165006 response:
Windows system to judge the location of the mouse click is a close button, sends WM_CLOSE message to the application, the application of the default processing of the message is closed form,


Project. The CPP file
Application - & gt; The Run ();//c + + Builder code
Method encapsulates the Windows message processing,
If is the win32 SDK program, to write their own code to handle each message,

CodePudding user response:

This form is you inherited form of the parent?

CodePudding user response:

Code has been DELPHI packing is good, so it's just we don't see the code

CodePudding user response:

TForm. OnClose Close button event handling is not really form, this is just the user code, real event handling is TCustomForm WMClose, is WM_CLOSE message map, in its internal call the Close method, Close internal call DoClose, DoClose internal testing whether the user code OnClose assignment, if there is a call,

CodePudding user response:

Closed is the WM_CLOSE message processing WMClose - & gt; Call you again to write their own code in DoClose OnClose (null not execute), even if you OnClose is empty, the somebody else had WMClose - & gt; DoClose still performed,

CodePudding user response:

TButton controls a ModalResult property set to mrOk or mrCancel equivalent window will close
  • Related