AdsLogFmtString

Issues a message via the TwinCAT Router.

object.AdsLogFmtString(
  nMsgType As ADSLOGMSGTYPE,
  strFmt As String,
  arg0 As Variant,
  arg1 As Variant,
  arg2 As Variant,
  arg3 As Variant
) As Long

Parameter

nMsgType

[in] Type of message (see the ADSLOGMSGTYPE data type)

strFmt

[in] The message text that is to be issued

arg0

[in] 1th parameter in the message text

arg1

[in] 2nd parameter in the message text

arg2

[in] 3rd parameter in the message text

arg3

[in] 4th parameter in the message text

Return value

See ADS error codes

Comments

The issued message is reported to all the ADS devices in which the filter conditions are satisfied. The issued message is also written into the Windows NT/2000/XP Event Logger.

There are three types of messages: Note, Warning and Error. The message that is issued must belong to one of these three types. Up to four numeric parameters can be specified in the message string. The following letters can be used as placeholders:

Placeholder

Meaning

%d

Placeholder for a variable of type long/integer

%f

Placeholder for a variable of type single/double

%x

Placeholder for a variable of type hexadecimal

%X

Placeholder for a variable of type hexadecimal

The first placeholder is then occupied by the first parameter (arg0), the second placeholder with the second parameter (arg1), and so on.

Make sure that not too many messages are transmitted in a short time, otherwise this could affect the overall system.

Hint: If you want to log messages in your program (e.g. malfunctions of a machine), you should use the TwinCAT Event Logger for this purpose. This is significantly more powerful than the Windows NT/2000/XP Event Logger, and is adapted to the requirements of automation technology.

Example

Visual Basic sample: 'Send/receive messages via the TwinCAT Router'