GetHeader

ITcEvent

The property returns a safearray that represents the same information as TcEventHeader.  The header data was append when the event was issued from the PLC function block (or other ADS device) or from a call to a Report Event Function like ITcEventLogC::ReportEvent,ITcEventC3::ReportEventEx or ITcEventLog::ReportEvent.

 

HRESULT GetHeader([in,out] SAFEARRAY(VARIANT)* data);

Parameters

data

[in] Pointer to a safearray with the bounds 0 to 9 that represents the event header. The array represents the same information as TcEventHeader. The items of the array are explained in the following table.

index

TcEventHeader item

DataType

Description

0

nClass

TcEventClass

The class of the alarm, like alarm, warning, hint

1

nPriority

TcEventPriority (long)

The event priority. Since now the priority is always: TcEventPriority.TCEVENTPRIO_IMPLICIT=0

2

dwFlags

TcEventFlags (long)

The flags control the behavior of the alarm. That could be combined by a OR junction.

3

dwUserData

long

A spare variable that can be used by the user.

4

nId

long

The event id, that unique represents this type of event for this one Event Source.

5

nInvokeId

long

 

6

fDate

VARIANT-DATE

The date and time when this event occur

7

nMs

long

The millisecond part of the event date

8

varSource

variant

The source id source name. The event source is used to distinguish different devices. Like I/O Event, or different parts of the PLC program.

9

szFmtProgId

BSTR string

The PrgId of the formatter. If we want to use the standard XML formatter the string should bet set to "TcEventFormatter.TcXmlFormatter"

Return Values

S_OK

Function was successfully called

E_POINTER

data 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 most recent active event
Dim evt As TcEvent
Set evt = evtLogger.GetLastEvent

' get the event header
Dim data() As Variant
Call evt.GetHeader(data)

' loop though the list of data
Dim i As Long
For i = LBound(data) To UBound(data)
  Debug.Print data(i)
Next i

Remarks

For C++ and Visual Basic programmers, it's more convenient to use the method ITcEventC::GetHeader