Exemple de traitement d'événements

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


      Option Explicit Private WithEvents mXfer As autECLXfer 'AutXfer added as reference sub main() 'Create Objects Set mXfer = New autECLXfer mXfer.SetConnectionByName "A" 'Monitor Session A mXfer.RegisterCommEvent ' register for Communications Link updates for session A ' Display your form or whatever here (this should be a blocking call, otherwise sub just ends call DisplayGUI() mXfer.UnregisterCommEvent set mXfer= Nothing End Sub 'This sub will get called when the Communication Link Status of the registered 'connection changes Private Sub mXfer _NotifyCommEvent() ' do your processing here End Sub 'This event occurs if an error happens in Communications Link event processing Private Sub mXfer _NotifyCommError() 'Do any error processing here End Sub 'This event occurs when Communications Status Notification ends Private Sub mXfer _NotifyCommStop() 'Do any stop processing here End Sub