void MessagesHook(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { try { g_Client->HandleMessage(hWnd, Msg, wParam, lParam); } catch (const std::exception& e) { MessageBoxA(0, e.what(), "Error", MB_ICONERROR); } catch (...) { MessageBoxA(0, "Unhandled error", "Error", MB_ICONERROR); FreeLibrary(g_Module); } }