
Y u should always call the base class IdleAction function in addition too
performing your own processing. If you’re writing applications for
Windows NT you can also use multiple threads for background,
processing.
Closing applications
Users usually close a Windows application by choosing File|Exit or
pressing
Alt+F4
. It’ important, though, that the application be able tos
intercept such an attempt, to give the user a chance to save any open files.
T pplication lets you do that.A
T pplication and all window classes have or inherit a member functionA
Changing closing
CanClose. Whenever an application tries to shut down, it queries the main
behavior
window’ and document manager’ CanClose function. If either of these hass s
children, it calls the CanClose function for each child. In turn, each child
calls the CanClose function of each of their children if any and so on.,
The CanClose function gives each object a chance to prepare to be shut
down. It also gives the object a chance to abort to the shutdown if
necessary When the object has completed its clean-up procedure, its.
CanClose function should return TRUE.
If any of the CanClose functions called returns FALSE, the shut-down
procedure is aborted.
The CanClose mechanism gives the application object, the main window,
Closing the
and any other windows a chance to either prepare for closing or prevent
application
the closing from taking place. In the end, the application object approves
the closing of the application. The normal closing sequence looks like this:
1. Windows sends a WM_CLOSE message to the main window.
2. The main window object’ EvClose member function calls the applications
object’ CanClose member function.s
3. The application object’ CanClose member function calls the mains
window object’ CanClose member function.s
4. The main window and document manager objects call CanClose for each
of their child windows. The main window and document manager
objects’ CanClose functions return TRUE only if all child windows’
CanClose member functions return TRUE.
128
OWL P ogrammer’ Guider s