EsbCancelProcess

Cancels an asynchronous process which has not yet completed.

Syntax

EsbCancelProcess (hCtx)
ByVal hCtx As Long
ParameterDescription

hCtx

VB API context handle.

Notes

Return Value

None.

Access

This function requires no special privilege.

Example

Declare Function EsbCancelProcess Lib "ESBAPIN" (ByVal hCtx As Long) As Long

Sub ESB_CancelProcess ()
   Dim sts As Long
   Dim CalcScript As String 
   Dim Calculate As Integer
   Dim ProcState As ESB_PROCSTATE_T
   Dim Items As Integer   CalcScript = "CALC ALL;"
   Calculate = ESB_YES   '***********
   ' Begin Calc
   '***********
   sts = EsbBeginCalc (hCtx, Calculate)
   '***********************
   ' Send Calc script
   ' It is possible to send
   ' more than one string 
   '***********************
   sts = EsbSendString (hCtx, CalcScript)   '*********
   ' End Calc 
   '*********
   sts = EsbEndCalc (hCtx)   '************************************
   ' Check process state and cancel it if
   ' it takes too long 
   '************************************
   sts = EsbGetProcessState (hCtx, ProcState)
   Items = 1
    Do While ProcState.State = ESB_STATE_INPROGRESS 
     Items = Items + 1
     If Items = 1000 Then      '***************
      ' Cancel process
      '*************** 
      sts = EsbCancelProcess (hCtx) 
     End If 
   Exit Do
      sts = EsbGetProcessState (hCtx, ProcState)
   Loop 
End Sub

See Also