// IToolSVCClr.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <vcclr.h> void OnChanged(System::Object^ sender, IToolS::Data::ChangedEventArgs ^e) { System::Console::WriteLine(System::String::Format("New value {0}", e->NewValue)); } int _tmain(int argc, _TCHAR* argv[]) { gcroot<IToolS::Lite::Communication::Variable^> variable = gcnew IToolS::Lite::Communication::Variable(); gcroot<IToolS::Lite::Communication::Client^> client = gcnew IToolS::Lite::Communication::Client(); gcroot<IToolS::Lite::Communication::Group^> group = gcnew IToolS::Lite::Communication::Group(); gcroot<IToolS::Lite::IOServers::IOServer^> ioserver = gcnew IToolS::Lite::IOServers::IOServer(); variable->VariableName = "var"; variable->Address = "10"; variable->Changed += gcnew IToolS::Data::ChangedEventHandler(OnChanged); group->Add(variable); ioserver->Name = "Simulation"; client->Group = group; client->IOServer = ioserver; client->Start(); System::Console::WriteLine("Press ENTER to exit"); System::Console::ReadLine(); client->Stop(); client->StopIOServer(); return 0; }
IToolS Blog