summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qcoreapplication_win.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp51
1 files changed, 17 insertions, 34 deletions
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index c1925e7..320f801 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -52,26 +52,31 @@
QT_BEGIN_NAMESPACE
-char appFileName[MAX_PATH]; // application file name
-char theAppName[MAX_PATH]; // application name
-HINSTANCE appInst = 0; // handle to app instance
-HINSTANCE appPrevInst = 0; // handle to prev app instance
-int appCmdShow = 0;
bool usingWinMain = false; // whether the qWinMain() is used or not
+int appCmdShow = 0;
Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
{
- return appInst;
+ return GetModuleHandle(0);
}
Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle
{
- return appPrevInst;
+ 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
}
Q_CORE_EXPORT QString qAppFileName() // get application file name
@@ -115,25 +120,6 @@ Q_CORE_EXPORT QString qAppFileName() // get application file name
return res;
}
-void set_winapp_name()
-{
- static bool already_set = false;
- if (!already_set) {
- already_set = true;
-
- QString moduleName = qAppFileName();
-
- QByteArray filePath = moduleName.toLocal8Bit();
- QByteArray fileName = QFileInfo(moduleName).baseName().toLocal8Bit();
-
- memcpy(appFileName, filePath.constData(), filePath.length());
- memcpy(theAppName, fileName.constData(), fileName.length());
-
- if (appInst == 0)
- appInst = GetModuleHandle(0);
- }
-}
-
QString QCoreApplicationPrivate::appName() const
{
return QFileInfo(qAppFileName()).baseName();
@@ -198,20 +184,17 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
already_called = true;
usingWinMain = true;
- // Install default debug handler
-
+ // Install default debug handler
qInstallMsgHandler(qWinMsgHandler);
- // Create command line
-
+ // Create command line
argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc);
- // Get Windows parameters
- appInst = instance;
- appPrevInst = prevInstance;
appCmdShow = cmdShow;
- set_winapp_name();
+ // Ignore Windows parameters
+ Q_UNUSED(instance);
+ Q_UNUSED(prevInstance);
}
/*!