beckhoff TX1000 — 3.1 Sample for a machine with Microsoft Silverlight for Windows Embedded

Samples Silverlight AdsPortCloseEx(port); return 0; } 6. Processing the source code The headers are integrated first in the SilverlightForEmbeddedMachineSample.cpp file. #include"pwinuser.h"#include"xamlruntime.h"#include"xrdelegate.h"#include"xrptr.h" #include"resou rce.h" The declaration of the variables follows.

IXRDelegate * clickdelegate; UINT exitcode; IXRVisualHostPtr vhost; IXRButtonBasePtr butClose; IXRRadioButtonPtr radSpeedSlow; IXRRadioButtonPtr radSpeedFast; IXRTextBlockPtr txtDeviceDown; IXRTextBlockPtr txtDeviceUp; IXRTextBlockPtr txtCount; IXRProgressBarPtr prgSteps; IXRStoryboardPtr timelineDeviceDown; IXRStoryboardPtr timelineDeviceUp; IXRStoryboardPtr timelineEngine; long port; AmsAddr addr; unsigned long TimerID; DWORD EventID; CRITICAL_SECTION cs; long event_cnt; long event_cntold; void __stdcall Callback(AmsAddr* addr, AdsNotificationHeader* handler, unsigned long User); The timer callback function checks the Ads connection and restores the connection if necessary.

VOID CALLBACK MyTimerProc( HWND hwnd, // handle to window for timer messages UINT message, // WM_TIMER message UINT idTimer, // timer identifier DWORD dwTimer) // current system time { if (event_cnt = event_cntold) { // Handels werden freigegeben und der Port geschlossen disconnect(port, &addr); // Kommunikationsport auf dem ADS Router цffnen port = AdsPortOpenEx(); addr.port = 0x321; long adserror = -1; // Neue Verbindung zur SPS herstellen.while(adserror != 0) { adserror = connect(port, &addr, Callback); Sleep(1000); } } TX1000 17 Version: 1.2