EnumLoggedEvents

ITcEventLog

Returns an enumeration object that is used to iterate through the list of logged events.

This method is provided for backward compatibility and usage from c++ client. Languages like VB or the .NET family should use EnumLoggedEventsEx.

HRESULTEnumLoggedEvents([out,retval] IUnknown** ppEnum);

Parameters

ppEnum

[out, retval] Pointer to the ITcEnumEvents interface pointer that receives the enumeration object of the logged 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.EnumLoggedEvents

' 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 behavior of the imported TcEventLogger type libraries is different under CodeGear C++Builder 2009 and Visual Studio C++. Both development environments generate different Code. In C++Builder the returned enumeration object is not automatically enabled if it leaves the visible range ("out of scope" ) e.g. after allocation:

ITcEnumEventsPtr enumEvt = evtLogger->EnumLoggedEvents(); 

the no longer used object has to  be enabled in C++Builder´:

enumEvt->Release();

There is a difference to the Microsoft Visual Studio C++ implementation. The the release call is not necessary. For this please use the EnumLoggedEventsEx() method in C++Builder. This method enables the returned object under C++Builder automatically.