My application has one main form and I have a button on that form to close/exit the application. Currently it’s written with a call to Windows to close the handle:
SendMessage(Handle, WM_CLOSE, 0, 0);
But I’m wondering what’s the harm in using:
formName.Close;
What’s the proper usage here? Is there any reason to use the SendMessage?
They do exactly the same thing. In fact, in
Forms.pasyou findshowing that the
WM_CLOSEmessage simply translates toSelf.Close.Generally, you should use
Closeif you can, since that is more Delphi-ish and shorter.