summaryrefslogtreecommitdiffstats
path: root/src/winmain/qtmain_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/winmain/qtmain_win.cpp')
-rw-r--r--src/winmain/qtmain_win.cpp59
1 files changed, 1 insertions, 58 deletions
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index 2944e07e00..e357814d0a 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -43,9 +43,7 @@
#include "qstring.h"
#include "qvector.h"
-#ifndef Q_OS_WINCE
-# include <shlobj.h>
-#endif
+#include <shlobj.h>
/*
This file contains the code in the qtmain library for Windows.
@@ -59,11 +57,7 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE)
-extern void __cdecl qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &);
-#else
extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &);
-#endif
QT_END_NAMESPACE
@@ -74,12 +68,8 @@ QT_USE_NAMESPACE
int qMain(int, char **);
#define main qMain
#else
-#ifdef Q_OS_WINCE
-extern "C" int __cdecl main(int, char **);
-#else
extern "C" int main(int, char **);
#endif
-#endif
/*
WinMain() - Initializes Windows and calls user's startup function main().
@@ -87,8 +77,6 @@ extern "C" int main(int, char **);
application.
*/
-#ifndef Q_OS_WINCE
-
// Convert a wchar_t to char string, equivalent to QString::toLocal8Bit()
// when passed CP_ACP.
static inline char *wideToMulti(int codePage, const wchar_t *aw)
@@ -116,48 +104,3 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int
delete [] argv;
return exitCode;
}
-
-#else // !Q_OS_WINCE
-
-int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR /*wCmdParam*/, int cmdShow)
-{
- QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit();
-
- wchar_t appName[MAX_PATH];
- GetModuleFileName(0, appName, MAX_PATH);
- cmdParam.prepend(QString(QLatin1String("\"%1\" ")).arg(QString::fromWCharArray(appName)).toLocal8Bit());
-
- int argc = 0;
- QVector<char *> argv(8);
- qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv);
-
- wchar_t uniqueAppID[MAX_PATH];
- GetModuleFileName(0, uniqueAppID, MAX_PATH);
- QString uid = QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"), QLatin1String("_"));
-
- // If there exists an other instance of this application
- // it will be the owner of a mutex with the unique ID.
- HANDLE mutex = CreateMutex(NULL, TRUE, (LPCWSTR)uid.utf16());
- if (mutex && ERROR_ALREADY_EXISTS == GetLastError()) {
- CloseHandle(mutex);
-
- // The app is already running, so we use the unique
- // ID to create a unique messageNo, which is used
- // as the registered class name for the windows
- // created. Set the first instance's window to the
- // foreground, else just terminate.
- // Use bitwise 0x01 OR to reactivate window state if
- // it was hidden
- UINT msgNo = RegisterWindowMessage((LPCWSTR)uid.utf16());
- HWND aHwnd = FindWindow((LPCWSTR)QString::number(msgNo).utf16(), 0);
- if (aHwnd)
- SetForegroundWindow((HWND)(((ULONG)aHwnd) | 0x01));
- return 0;
- }
-
- int result = main(argc, argv.data());
- CloseHandle(mutex);
- return result;
-}
-
-#endif // Q_OS_WINCE