int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: Place code here. MSG msg; HACCEL hAccelTable; //Controller cController(0x1, &g_cModbus); /*< Controller object */ // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MOUSECONTROLLER, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } // Perform HW initialization: if (!InitHardware()) { return FALSE; } g_cController = new Controller(1, &g_cModbus); g_cController->setSerialPort(&g_cSerialPort); /// Setup GUI callbacks g_cController->setGuiCallback(updateVector); g_cController->setTraceCallback(updateConsole); /// Start controller thread g_cController->start(); hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MOUSECONTROLLER)); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } g_cController->terminate(); g_cSerialPort.close(); return (int) msg.wParam; }