1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
// NOLINTBEGIN(*)
//+=============================================================================
//
// file : main.cpp
//
// description : C++ source for a TANGO device server main.
// The main rule is to initialise (and create) the Tango
// system and to create the DServerClass singleton.
// The main should be the same for every Tango device server.
//
// project : TANGO
//
// author(s) : A.Gotz + E.Taurel
//
//
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
#include <tango/tango.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
Tango::Util *tg;
try
{
//
// Initialise the device server
//
tg = Tango::Util::init(hInstance, nCmdShow);
//
// Create the device server singleton which will create everything
//
tg->server_init(true);
//
// Run the endless loop
//
cout << "Ready to accept request" << std::endl;
tg->server_run();
}
catch(std::bad_alloc)
{
MessageBox((HWND) NULL, "Memory error", "Command line", MB_ICONSTOP);
return (FALSE);
}
catch(Tango::DevFailed &e)
{
MessageBox((HWND) NULL, e.errors[0].desc.in(), "Command line", MB_ICONSTOP);
return (FALSE);
}
catch(CORBA::Exception &)
{
MessageBox((HWND) NULL, "CORBA Exception", "Command line", MB_ICONSTOP);
return (FALSE);
}
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
delete tg;
return msg.wParam;
}
// NOLINTEND(*)
|