void EngineWidget::StartEngine(){ if (m_hThread) return; DWORD dwThreadId = -1; if ((m_hThread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadFunc, (LPVOID)this, 0, &dwThreadId)) != NULL) { ; }}
static DWORD WINAPI threadFunc(LPVOID pWidg){ QWidget* wdt = (QWidget*)pWidg; WNDCLASSEX windowClass; HINSTANCE engineInstance; HWND engineWindow; HINSTANCE h = ::GetModuleHandle(QApplication::applicationFilePath().toAscii()); windowClass.cbSize = sizeof(WNDCLASSEX); windowClass.style = CS_NOCLOSE | CS_OWNDC; windowClass.lpfnWndProc = &DefWindowProc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = engineInstance; windowClass.hIcon = nullptr; windowClass.hCursor = LoadCursor(nullptr, IDC_ARROW); windowClass.hbrBackground = nullptr; windowClass.lpszMenuName = nullptr; windowClass.lpszClassName = APPLICATION_NAME; windowClass.hIconSm = nullptr; RegisterClassEx(&windowClass); // RA changes engineWindow = CreateWindow(APPLICATION_NAME, APPLICATION_NAME, WS_CHILD|WS_VISIBLE, 0, 0, 1280, 1024, (HWND)wdt->winId(), nullptr, h, nullptr); // RA changes SetFocus(engineWindow); SetCursor(windowClass.hCursor); do { MSG message; while (PeekMessage(&message, engineWindow, 0, 0, PM_REMOVE)) { DispatchMessage(&message); } }while(true); return FALSE;}