SourceName
The property SourceName returns the formatted source name for the requested language. Internally it calls the method ITcLogFormatter::GetSourceName 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 SourceName([in] long langId, [out,retval] BSTR* szName);
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 |
szName
[out, retval] Pointer to an BSTR string that returns the formatted string for the event source name.
Return Values
S_OK
Function was successfully called
E_POINTER
szName 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 source name in English
Dim name As String
name = evt.SourceName(1033)
Debug.Print name
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