beckhoff — 5.2.1 Compatibility

Connectivity adsLogCLient.Connect( strNetId ); m_logger = (TcEventLog)adsLogCLient; } void ConnectLocalPC() { m_logger = new TCEVENTLOGGERLib.TcEventLog(); } 4. Write currently active events to the console window foreach( TcEvent evt in m_logger.EnumActiveEventsEx() ) Console.WriteLine( evt.GetMsgString(1033) ); Developing a C++ application that supports both versions of the TcEventLogger 1. Import type libraries of the "Beckhoff TcEventLogger" and the "Beckhoff TcEventLogCEProxy" #pragma warning(disable:

4192) #import "C:\TwinCAT\TcEventLogger\TcEventlogger.exe" no_namespace, named_guids #import "C:\TwinCAT\TcEventLogger\TcEventLogAdsProxy.dll" no_namespace, named_guids #pragma warning(default: 4192) 2. Add a member variable for the TcEventLogger object ITcEventLogPtr m_spTcEventLog; 3. Use theese two methods to connect either to a local PC Based TcEventLogger or an remote Win- dowsCE system.

If your application is a Windows CE and shall connect the local logger pass Null for the NetId HRESULT ConnectRemoteLogger( BSTR strNetId ) { HRESULT hr = E_FAIL; if ( m_spTcEventLog == NULL ) { hr = m_spTcEventLog.CreateInstance(CLSID_TcEventLogAdsProxy); if ( SUCCEEDED(hr) ) { ITcEventLogAdsProxyPtr spLogCE = m_spTcEventLog; hr = spLogCE->Connect( strNetId ); // 5.1.47.197.1.1 } } } void ConnectPC( BSTR strComputer ) { HRESULT hr=E_FAIL; COSERVERINFO comServerInfo={0}; comServerInfo.pwszName = strComputer ; MULTI_QI mQI={&IID_ITcEventLog, NULL, 0}; if ( m_spTcEventLog == NULL ) hr=::CoCreateInstanceEx(CLSID_TcEventLog, NULL, CLSCTX_SERVER, &comServerInfo, 1, TcEventLogger 18 Version: 1.1