GetMsgString

ITcEvent

The method GetMsgString returns the formatted message string for the requested language. Internally it calls the method ITcLogFormatter::GetCompleteString of the formatter that was assigned when the event was issued from a COM client or through an ADS call to the TcEventLog object of the TcEventLogger.

 

HRESULT LoggedEvents([in] long langId,
[out,retval] BSTR* msg);

Parameters

langId

[in] The language Id of the requested language. The requested language should be tagged by *LCIDs. The next table shows a sample for some language ids. In the configuration of the event formatter the languages are tagged by the same language id

LCID

Description

1031

German

1033

US English

1034

Spanish - Spain

1036

French

msg

[out, retval] Pointer to an BSTR string that returns the formatted string for the requested language.

Return Values

S_OK

Function was successfully called

E_POINTER

msg 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 message in English
Dim strMessage As String
strMessage = evt.GetMsgString(1033)
Debug.Print strMessage

Remarks

Most standard formatter like the XML base formatter (TcEventFormatter.TcXmlFormatter) will try to return a string for the default language if the requested language does not exist in the configuration of the formatter.

*LCID: for more information see MSDN Library