Exemple de traitement d'événements

Ce qui suit est un court exemple de la façon d'implémenter les événements OIA


      Option Explicit Private WithEvents myOIA As autECLOIA 'AutOIA added as reference sub main() 'Create Objects Set myOIA = New AutOIA Set myConnMgr = New AutConnMgr myOIA.SetConnectionByName ("B") 'Monitor Session B for OIA Updates myOIA.RegisterOIAEvent 'register for OIA Notifications ' Display your form or whatever here (this should be a blocking call, otherwise sub just ends call DisplayGUI() 'Clean up myOIA.UnregisterOIAEvent Private Sub myOIA_NotifyOIAEvent() ' do your processing here End Sub Private Sub myOIA_NotifyOIAError() ' do your processing here End Sub 'This event occurs when Communications Status Notification ends Private Sub myOIA_NotifyOIAStop(Reason As Long) 'Do any stop processing here End Sub