Function SetCancel() Foundation
Sets or returns whether the program can be terminated using Alt+C or Ctrl+Break.
SetCancel( [<lToggle>] ) --> lOldSetCancel
When SetCancel() is called without an argument, the function returns the current setting as a logical value. If <lToggle> is specified, the new setting specified by <lToggle> is set, and the value of the old setting is returned.
The environment function SetCancel() sets or removes the key combination Alt+C as a method to terminate a program. In the production version of applications, the Alt+C key combination should generally be disabled as a method to terminate the application, in order to force the user to leave the application by normal means.
// The example shows a typical use of SetCancel(). When the
// #define constant DEBUG is set, the program can be terminated
// with Alt+C. When the constant is not defined (as is done for
// the final production version), the program can no longer be
// terminated with Alt+C.
#include "Inkey.ch"
PROCEDURE Main
LOCAL nKey := 0
#ifndef DEBUG // no debug version
SetCancel(.F.) // turn off Alt+C
#endif
DO WHILE nKey <> K_ESC
nKey := Inkey(0)
? "The inkey code of the last key is:", nKey
ENDDO
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.