Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Capture Cancel Terminate Close Ctrl Break WM_Close IntControl 1008 BoxOpen BoxesUp 193
IntControl (1008, 1, 0, 0, 0)Question: How can I require the user to confirm the termination, i.e.
AskYesNo("Quit","Do you really want to quit now?")I have investigated various permutations of IntControl 12 and the :Cancel label (intControl 72), but I haven't "guessed" the answer yet.
Results I have produced so far:
Unfortunately a Ctrl+Break abruptly cancels the script, and therefore no further processing can occur.
One workaround is to call the script from another WinBatch script. Then setting an 'exit code' in the called script that can be checked by the calling script. The calling script would need to call RunShell and use the @GETEXITCODE parameter, which will cause the exit code of an application that is launched with the RunShell function will be returned. This is the same as specifying @WAIT, except that on success the function will return the exit code of the application that was launched.
In calling script you can check the value of exit code. If the script was unfinished (i.e. user Ctrl-breaked) then the exit code would be set to some special value.
For Example
;Main.wbt exitcode = RunShell( DirScript():'secondary.wbt', '', '', @NORMAL, @GETEXITCODE ); Zero on success, positive value on error/ctrl-break Pause('ExitCode is', exitcode) ;Add code here to check exit code. If non zero then call askyesno Exit
;Secondary.wbt ; Set Exit code to positive value for incomplete IntControl(1000,999,0,0,0) For x = 1 To 10 TimeDelay(1) Next ; Set Exit code to 0 for success IntControl(1000,0,0,0,0) Exit
Article ID: W17684
Filename: IntControl 1008 Capture Close Request.txt
File Created: 2012:11:26:09:11:02
Last Updated: 2012:11:26:09:11:02