UserData

ITcEvent

The property returns the user defined data of the event. The user data was assigned when the event was issued from the PLC function block (or other ADS device) or from a call to a Report EventFunction like ITcEventLogC::ReportEvent, ITcEventC3::ReportEventEx or ITcEventLog::ReportEvent with the TcEventFlags.

 

HRESULT UserData([out, retval]
long *pVal);

Parameters

pVal

[out, retval] Pointer to a BOOL value that receives the confirmation flag. It´s false if the value is 0, it´s true if the value is not equal to 0.

Return Values

S_OK

Function was successfully called

E_POINTER

pVal 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 MustConfirm flag
Dim mustConf As Long
mustConf = evt.mustConfirm
If mustConf <> 0 Then
  Debug.Print "Must Confirmed!"
Else
  Debug.Print "Must Not Confirmed!"
End If

Remarks

The return value is not from the type of VARIANT_BOOL the Visual Basic type BOOLEAN. In Visual Basic it occurs as a long value. We must check if it's not equal 0 if the flag is set.