Next

ITcEnumEvents

This method returns the next number of events in the enumeration sequence

HRESULT Next(
    [in] long celt,
    [out,size_is(celt),length_is(*pceltFetched)]IDispatch** ppElements, 
    [out, retval] long *pceltFetched);

Parameter

celt

[in] Number of requested elements of the enumeration sequence

ppElements

[out, size_is(celt), length_is(*pceltFetched)] Pointer to the first element of an array of events. Returns the by pceltFetched given number of events

pceltFetched

Returns the number of returned events.

Return Values

S_OK

Function was successfully called.

S_FALSE

Number of returned elements was less than the requested

E_POINTER

Elements or pceltFetched were 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)
  ' print the event message in english
  Debug.Print evt.GetMsgString(1033)
  ' release the evt object
  Set arrEvt(i) = Nothing
 Next i
Loop While (nFetched >= coMax)

Remarks

The Next method only works from languages which pass references to array types to the COM Interface.
E.g. .NET languages only pass a pointer to the dereferenced first element of an array. From such languages use the VBNext method.