WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

FAQs - Frequently Asked Questions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Terminating WIL processing

Keywords:  terminate terminating a WinBatch script intcontrol ctrl break

Question:

How do I terminate a WinBatch Script?

I have a couple of batches which are constantly running during an NT user session. Whenever that user logs out, he is presented with several dialogs which ask "OK to terminate batch file." User always clicks 'yes'.

Is there any way to prevent that "OK to terminate" dialog box? I have looked at IntControl(1005) but am miffed about how or if to use it.

Answer:

A currently-executing WIL program can be terminated immediately by pressing the CTRL BREAK key combination. You may need to hold it a second or two, or ...

Allow Windows to be exited with no warning:


	IntControl(12,1,0,0,0)
at the top of each of the relevant WBT files.

This allows "quiet termination" when the user logs off.

Allow quiet termination:


	IntControl(12,4,0,0,0)
to exit WinBatch quietly.

Refuse to terminate.:

To suppress the users' ability to terminate the batch file, you could use:

        IntControl(12,8,0,0,0)

We strongly suggest that you completely debug the batch file before doing this.

To both Exit Windows and Terminate WinBatch Script Quietly:


        Intcontrol(12,5,0,0,0)
        Intcontrol(67,0,0,0,0)
To protect a script from terminating, use some variation of IntControl(12...)

I usually use:

        IntControl(12,9,0,0,0)
The 9 is derived from adding the 8+1 options (see help file).

Intcontrol(12,8,0,0,0) and Termination WIL Dialog Boxes:

Question:

I'm using the Winbatch Compiler (96M) with Windows NT4 and attempting to prevent breakout from a program which is run as part of an auto-logon environment. I've tried many variants of IntControl(12) e.g. IntControl(12,8,0,0,0) at the top of my WIL DIalog, but find that this doesn't prevent breakout with ctrl/break.

Can there be something I've overlooked or misunderstood as all the documentation indicates this should work?

Answer:

IntControl(12,8,0,0,0) should prevent the CTRL-Break termination of the script. However, be aware that if sitting at a WIL dialog box with a CANCEL button, Ctrl-Break is interpreted as pressing the cancel button. If you do not have cancel button handling in your script, the script will terminate.

Even if you have not set up a Cancel button on your WIL Dialog, unless otherwise defined, there is always a Cancel which you need to intercept by redefining the :Cancel label.

Something like:

NPCSAuthFormat=`WWWDLGED,5.0`
NPCSAuthCaption=Strcat(station, ` : NPCS Authentication for Windows NT`)
NPCSAuthX=57
NPCSAuthY=76
NPCSAuthWidth=182
NPCSAuthHeight=94
NPCSAuthNumControls=5
NPCSAuth01=`22,22,64,DEFAULT,STATICTEXT,DEFAULT,"Username"`
NPCSAuth02=`22,46,64,DEFAULT,STATICTEXT,DEFAULT,"Password"`
NPCSAuth03=`100,22,64,DEFAULT,EDITBOX,Username,""`
NPCSAuth04=`100,46,64,DEFAULT,EDITBOX,PW_user,""`
NPCSAuth05=`60,72,64,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1`

ButtonPushed=Dialog("NPCSAuth")


;DA MAGIC BELOW:

:CANCEL
Message("All","Done")
There's more info on this at:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/FAQs~-~Frequently~Asked~Questions+How~to~Prevent~Cancel~Button~from~Quitting~App.txt


Article ID:   W13001
Filename:   Terminate or Prevent Terminate Winbatch.txt
File Created: 2017:08:29:12:01:06
Last Updated: 2017:08:29:12:01:06