Event Processing Example

The following is a short example of how to implement Start Events:

Option Explicit
Private WithEvents mCmgr As autECLConnMgr 'AutConnMgr added as reference
dim mSess as object
 
sub main()
'Create Objects
Set mCmgr = New autECLConnMgr
Set mSess = CreateObject("ZIEWin.autECLSession")
mCmgr.RegisterStartEvent 'register for PS Updates
 
' Display your form or whatever here  (this should be a blocking call, otherwise sub just ends
call DisplayGUI()
mCmgr.UnregisterStartEvent
set mCmgr = Nothing
set mSess = Nothing
End Sub
 
'This sub will get called when a session is started or stopped
Private Sub mCmgr_NotifyStartEvent(Handle as long, bStarted as Boolean)
' do your processing here 
if (bStarted) then
mSess.SetConnectionByHandle Handle
end if
End Sub
 
'This event occurs if an error happens 
Private Sub mCmgr_NotifyStartError()
'Do any error processing here
End Sub
 
Private Sub mCmgr_NotifyStartStop(Reason As Long)
'Do any stop processing here
End Sub