onClose (Callback)


onClose (hWnd)

This callback is invoked when the user attempts to close a window

Parameter Description
hWnd The handle to the window the user is attempting to close

Returns

0

Remarks

This is a callback function. You must supply this function yourself. To register this callback, use the WinXRegOnClose function.

The onClose callback has a number of uses. You can use it to display an "Are you sure?" message when the user attempts to quit your application. You can also use it to quit the entire application when a particular window is closed (as opposed to when any window is closed when you don't register this callback).

Examples

'A sample onClose

FUNCTION onClose (hWnd)

' Is this the main window?
IF hWnd = #hMain THEN

' It is so quit the application
' PostQuitMessage(0) causes WinXDoEvents to return
PostQuitMessage(0)

ELSE

' This is not the main window, so don't quit the app
' But we do still need to destroy the window
DestroyWindow (hWnd)

END IF

END FUNCTION

Related Links

WinXRegOnClose