Working with the 'Alarm' objects
Every alarm action (receive/clear/acknowledge) executes an event available for VB(A). The object must be defined WithEvents.
Dim WithEvents zAlarm As Alarm
'procedure is executed on startup of the zenOn runtime
Private Sub Project_Active()
'init the alarm object for events
Set zAlarm = thisProject.Alarm
End Sub
'procedure is executed when an Alarm comes
Private Sub zAlarm_AlarmComes(ByVal obItem As IAlarmItem)
'print specific information to Debug window...
Debug.Print obItem.Timecomes & " > " & obItem.Text
End Sub
'procedure is executed when an Alarm has gone
Private Sub zAlarm_AlarmGoes(ByVal obItem As IAlarmItem)
'print specific information to Debug window...
Debug.Print obItem.Timegoes & " < " & obItem.Text
End Sub
'procedure is executed when an Alarm was acknowledged by a user
Private Sub zAlarm_AlarmAcknowledged(ByVal obItem As IAlarmItem)
'print specific information to Debug window...
Debug.Print obItem.TimeAcknowledged & " | " & obItem.Text
End Sub
'procedure is executed on terminating the zenOn Runtime
Private Sub Project_Inactive()
'free the alarm object
Set zAlarm = Nothing
End Sub
This is a migrated post! Originally posted on 16.08.2007 by user robertf. Please be aware that information can be outdated.