it is easy to control close button "x".You just write code in the Form's Unload event.
such as:
Form Unload
Private Sub Form_Unload(Cancel as integer)
Const conBtn As integer=.........
dim intUserResponse As interger
intUserResponse=MsgBox("...",conBtns,"....")
if intUserResponse=vbNo then
Cancel=1
End if
End sub
In your user interface, if you add a Exit control, you can code like this.
cmdExit Click
Private Sub cmdExit_Click()
Unload frmInterface
End Sub
you know, when you click exit button or click "X", it will triggers the form's Unload event. Then you will see a MsgBox, very friendly.
if you want discuss it further, please send email to me: wyzhou@hotmail.com
Have fun!