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

Killing and Terminating Apps

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

Terminate WinBatch after 30 Minutes of Inactivity

Keywords:   Terminate WinBatch after 30 minutes of inactivity 

Question:

I have a WinBatch program that I would like to terminate after 30 minutes of inactivity. This program displays a dialog using AskItemList and awaits a user selection. Once a selection is made I use the Run command to run another application. However, I would like to terminate the AskItemList if the user does not select a new item from the list after 30 minutes.

Answer:

You could design your own dialog AskItemList, using the WIL Dialog Editor. then use a Dialog Callback procedure, with a timer.


#DefineFunction MyDialogProc(D_Handle,D_Message,D_ControlID,Reserved_0,Reserved_1)
  MSG_INIT=0
  MSG_TIMER=1
   
   Switch D_Message

      Case MSG_INIT
         ; 30 minutes * 60 seconds per minute * 1000 milliseconds per second
         DialogProcOptions(D_Handle,MSG_TIMER,30*60*1000)
         Break

      Case MSG_TIMER
          Return(2)

   EndSwitch
   Return(-1)
#EndFunction
 




mylist="apples banannas pears oranges tangarines"
mylist=StrReplace(mylist," ",@TAB)



MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`Choose a list item`
MyDialogX=002
MyDialogY=030
MyDialogWidth=134
MyDialogHeight=180
MyDialogNumControls=003
MyDialogProcedure=`MyDialogProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,128|255|255`

MyDialog001=`022,153,033,011,PUSHBUTTON,DEFAULT,"OK",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`071,153,033,011,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`015,015,096,125,ITEMBOX,mylist,DEFAULT,DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")

Message(Buttonpushed,mylist)


Article ID:   W15532
File Created: 2003:05:28:10:21:08
Last Updated: 2003:05:28:10:21:08