summaryrefslogtreecommitdiffstats
path: root/src/activeqt/control/qaxservermain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/activeqt/control/qaxservermain.cpp')
-rw-r--r--src/activeqt/control/qaxservermain.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp
index 1849b47..de86ed6 100644
--- a/src/activeqt/control/qaxservermain.cpp
+++ b/src/activeqt/control/qaxservermain.cpp
@@ -252,19 +252,21 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR,
}
if (run) {
- HRESULT hRes = CoInitialize(0);
-
- int argc;
- QVector<char*> argv(8);
- qWinMain(hInstance, hPrevInstance, unprocessed.data(), nShowCmd, argc, argv);
- qAxInit();
- if (runServer)
- QAxFactory::startServer();
- nRet = ::main(argc, argv.data());
- QAxFactory::stopServer();
- qAxCleanup();
- CoUninitialize();
-
+ if (SUCCEEDED(CoInitialize(0))) {
+ int argc;
+ QVector<char*> argv(8);
+ qWinMain(hInstance, hPrevInstance, unprocessed.data(), nShowCmd, argc, argv);
+ qAxInit();
+ if (runServer)
+ QAxFactory::startServer();
+ nRet = ::main(argc, argv.data());
+ QAxFactory::stopServer();
+ qAxCleanup();
+ CoUninitialize();
+ } else {
+ qErrnoWarning("CoInitialize() failed.");
+ nRet = -1;
+ }
}
return nRet;