diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-20 07:54:09 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-06-20 07:54:09 +0000 |
commit | 5f0ec7305e4310123ddeb98d3523087e3c560d9c (patch) | |
tree | fbcad900b0b604a1005320c5015723c343807974 /src/corelib/kernel/qcoreapplication_win.cpp | |
parent | 683c30074e4b7c9048e9970de1851e5d9a6deeb4 (diff) | |
parent | e32f1a4d61f0c55d066a43657ad607131be8ca34 (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/corelib/kernel/qcoreapplication_win.cpp')
-rw-r--r-- | src/corelib/kernel/qcoreapplication_win.cpp | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 601733b939..0e2d4e2324 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -55,7 +55,10 @@ QT_BEGIN_NAMESPACE int appCmdShow = 0; -#if defined(Q_OS_WINRT) +// GetModuleFileName only exists for MSVC2015 and upwards for WinRT, meaning +// Windows 10 (Mobile). Hence take the first argument passed to the +// QCoreApplication contructor for older versions as a fallback on older platforms. +#if defined(Q_OS_WINRT) && _MSC_VER < 1900 Q_CORE_EXPORT QString qAppFileName() { @@ -67,31 +70,7 @@ QString QCoreApplicationPrivate::appName() const return QFileInfo(QCoreApplication::arguments().constFirst()).baseName(); } -#else - -Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle -{ - return GetModuleHandle(0); -} - -Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle -{ - return 0; -} - -Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command -{ -#if defined(Q_OS_WINCE) - return appCmdShow; -#else - STARTUPINFO startupInfo; - GetStartupInfo(&startupInfo); - - return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) - ? startupInfo.wShowWindow - : SW_SHOWDEFAULT; -#endif -} +#else // !(defined(Q_OS_WINRT) && _MSC_VER < 1900) Q_CORE_EXPORT QString qAppFileName() // get application file name { @@ -139,6 +118,34 @@ QString QCoreApplicationPrivate::appName() const return QFileInfo(qAppFileName()).baseName(); } +#endif // !(defined(Q_OS_WINRT) && _MSC_VER < 1900) + +#ifndef Q_OS_WINRT + +Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle +{ + return GetModuleHandle(0); +} + +Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle +{ + return 0; +} + +Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command +{ +#if defined(Q_OS_WINCE) + return appCmdShow; +#else + STARTUPINFO startupInfo; + GetStartupInfo(&startupInfo); + + return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) + ? startupInfo.wShowWindow + : SW_SHOWDEFAULT; +#endif +} + /***************************************************************************** qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp *****************************************************************************/ |