WinRT: Properly return exit code

Instead of returning the HRESULT of the Run method, return the actual
exit code of the application.

Change-Id: I1e3d654ecdb4c319d4a08fe8a11e8699d186f66b
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
This commit is contained in:
Andrew Knight 2014-01-05 01:56:38 +02:00 committed by The Qt Project
parent d5e52ecf6d
commit 1f31c6c6b1

View File

@ -77,6 +77,8 @@ using namespace Microsoft::WRL;
#define CoreApplicationClass RuntimeClass_Windows_ApplicationModel_Core_CoreApplication
typedef ITypedEventHandler<Core::CoreApplicationView *, Activation::IActivatedEventArgs *> ActivatedHandler;
static int g_mainExitCode;
class AppContainer : public Microsoft::WRL::RuntimeClass<Core::IFrameworkView>
{
public:
@ -109,7 +111,8 @@ public:
while (!IsDebuggerPresent())
WaitForSingleObjectEx(GetCurrentThread(), 1, true);
}
return main(m_argv.count(), m_argv.data());
g_mainExitCode = main(m_argv.count(), m_argv.data());
return S_OK;
}
HRESULT __stdcall Uninitialize() { return S_OK; }
@ -178,5 +181,6 @@ int WinMain()
if (FAILED(RoGetActivationFactory(qHString(CoreApplicationClass), IID_PPV_ARGS(&appFactory))))
return 2;
return appFactory->Run(Make<AppViewSource>(argc, argv).Get());
appFactory->Run(Make<AppViewSource>(argc, argv).Get());
return g_mainExitCode;
}