Exemple de traitement d'événements
Ce qui suit est un court exemple de la façon d’implémenter les événements WinMetrics.
Option Explicit Private WithEvents mWmet As autECLWinMetrics 'AutWinMetrics added as reference sub main() 'Create Objects Set mWmet = New autECLWinMetrics mWmet.SetConnectionByName "A" 'Monitor Session A mWmet.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() mWmet.UnregisterCommEvent set mWmet = Nothing End Sub 'This sub will get called when the Communication Link Status of the registered 'connection changes Private Sub mWmet _NotifyCommEvent() ' do your processing here End Sub 'This event occurs if an error happens in Communications Link event processing Private Sub mWmet _NotifyCommError() 'Do any error processing here End Sub 'This event occurs when Communications Status Notification ends Private Sub mWmet _NotifyCommStop() 'Do any stop processing here End Sub