beckhoff — 9.3.1.4 EnumActiveEvents

API [out, retval] pointer to an object of the interface type IDispatch that returns the most recent active event. Return Values S_OK Function was successfully called E_POINTER the pointer assign to lastEvent was not valid Visual Basic sample code ' get the one and only event logger Dim evtLogger As TCEVENTLOGGERLib.TcEventLog Set evtLogger = New TCEVENTLOGGERLib.TcEventLog ' get the most recent logged event Dim resentEvt As TcEvent Set resentEvt = evtLogger.GetLastEvent 9.3.1.4 EnumActiveEvents ITcEventLog [ } 129] Returns an enumeration object that is used to iterate through the list of active events. This method is provided for backward compatibility and usage from c++ client.

Languages like VB or the .NET family should use EnumActiveEventsEx [ } 131] . HRESULTEnumActiveEvents([out,retval] IUnknown** ppEnum); Parameters ppEnum [out, retval] Pointer to the ITcEnumEvents [ } 150] interface pointer that receives the enumeration object of the active events. Return Values S_OK Function was successfully called E_POINTER ppEnum was no valid pointer.

Visual Basic sample code ' get the one and only event logger Dim evtLogger As TCEVENTLOGGERLib.TcEventLog Set evtLogger = New TCEVENTLOGGERLib.TcEventLog ' get the active event enumaration object Dim enumEvt As ITcEnumEvents Set enumEvt = evtLogger.EnumActiveEvents ' try to get max events an loop through the event list Const coMax As Long = 20 Dim i As Long Dim nFetched As Long Dim evt As TcEvent Dim arrEvt(1 To coMax) As Object Do nFetched = enumEvt.Next(coMax, arrEvt(1)) For i = 1 To nFetched Set evt = arrEvt(i) TcEventLogger 132 Version: 1.1