VbNext

ITcEnumEvents

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

HRESULT VbNext(
    [in] long celt,
    [in,out]SAFEARRAY(VARIANT)* elements, 
    [out, retval] long *pceltFetched);

Parameter

celt

[in] Number of requested elements of the enumeration sequence

ppElements

[in] Pointer to a safearray that is going to be filled with number of pceltFetched event objects

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() As Variant
Do
  nFetched = enumEvt.VbNext(coMax, arrEvt)
  For i = LBound(arrEvt) To UBound(arrEvt)
    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)