Just a warning - I do this on all my forms (minimize, restore and close
button). But the user more than likely can still select File, Close from the
menu bar if they want to. I had one customer that did that all the time,
because that's what they were used to doing in Windows. So if you really want
to guarantee that they can only close the form with your button, you can one
of two things (there may be other solutions as well). 1, you can use your own
menu bar or disable the menu bar. 2, you can define a variable in your form
module declarations section to keep track of whether your close button was
used. Set it to false in the Form Open event proc, set it to True in the
Close button event proc. Then create a Form Unload event proc and check to
see if the variable is set to True. If not, issue a message to the user
telling them they must use the form's buttons and cancel the Unload.