ContentsIndexPreviousNext

8.14 System Menu "Close" Handling Under Windows

The Windows system menu has a "Close" item. Normally, if the user selects this entry, the runtime system performs a normal shut down. This is controlled by the QUIT-MODE configuration variable.

A QUIT-MODE setting of zero or less is handled directly by the runtime system, as described in Appendix H, Book 4, "Reference Manual." A positive QUIT-MODE setting allows your program to manage the close action instead. When a positive value is used, the "Close" item becomes a standard menu item with an ID equal to the value of QUIT-MODE. You may then handle the "Close" item just like any other menu item.

For example, if you set QUIT-MODE to "100", then your program will receive exception value 100 when the user selects the "Close" item. If you wanted to call a special shutdown program when the user selected "Close", you could assign the "Close" action to a hot-key program. For example:

MENU-ITEM  Hot-Key="shutdown"  100

In this example, the program "shutdown" might pop up a small window to confirm that the user wanted to exit and, if so, do a STOP RUN.