AddConnection

ITcEventView

This method adds a connection to a remote pc on the network.

By default, the connection is established using *DCOM. By using the prefix ADS:// a connection is established by using **ADS

HRESULT AddConnection(BSTR strComputerName);

Parameters

strComputerName

[in] BSTR string that holds the name of the remote PC the EventView want to connect to.

Return Values

S_OK

Function was successfully called

TCEVTVIEWERR_ADVISESINK = 0xF1000000

A connection to the remote computer has been established but the EventSink could not be advised. In this case events can only be polled by calling ShowEvents.

The high order byte does describe the error case, the low order bytes are the actual Win32 error code returned by the DispEventAdvise call.

TCEVENTERR_ADS = 0x98200000

When using ADS for remote connections, ADS errors may be passed through. The original ADS error code is stored in the low order word.

 

Visual Basic sample code

Option Explicit

' add the Beckhoff TcEvent View Library to the components
' place a TcEventView on the form, and assign the name TcEventView1

Private Sub Form_Load()
 Call TcEventView1.AddConnection("BeltPC1")
End Sub

Remarks

*DCOM: DCOM should just be used on very stable networks. DCOM must be set up correctly on the PC that uses the TcEventView and on the PC that provides the TcEventLogger by using dcomcnfg.exe. For more information see MSDN library.

**ADS: An ADS connection needs to be configured before connection. Both systems need to meet certain minimum requirements. Further information can be found here