xHarbour Reference Documentation > Function Reference |
Determines if Alt+C and Ctrl+Break terminate an application
SetCancel( [<lOnOff>] ) --> lOldSetting
The function returns the setting which is active before SetCancel() is called.
SetCancel() is used to disable the automatic program termination routine which can be activated by pressing the keys Alt+C or Ctrl+Break. The setting is .T. (true) by default. When a user presses either key combination, an xHarbour application is terminated unconditionally.
If automatic program termination is not desired, SetCancel() should be set to .F. (false) and a program termination routine should be implemented.
See also: | SET ESCAPE, SET KEY, Set(), SetKey() |
Category: | Environment functions |
Source: | rtl\set.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates howto override the default program termination // for Alt+C or Ctrl+Break with a user defined one. #include "Inkey.ch" PROCEDURE Main WAIT "Alt+C terminates unconditionally" SetCancel( .F. ) SetKey( K_ALT_C, {|| MyExitProc() } ) WAIT "Alt+C calls user defined exit routine" ? "Normal program termination" RETURN PROCEDURE MyExitProc LOCAL n := Alert( "Exit program?", { "Yes", "No" } ) IF n == 1 ? "User terminated program" QUIT ENDIF RETURN
http://www.xHarbour.com