summaryrefslogtreecommitdiffstats
path: root/src/winmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/winmain')
-rw-r--r--src/winmain/qtmain_win.cpp59
-rw-r--r--src/winmain/winmain.pro4
2 files changed, 2 insertions, 61 deletions
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index bf416e11d3..7087176110 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -53,9 +53,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.
@@ -69,11 +67,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
@@ -84,12 +78,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().
@@ -97,8 +87,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)
@@ -126,48 +114,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
diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index b4977653ce..2bb7529456 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -23,7 +23,7 @@ winrt {
} else {
SOURCES = qtmain_win.cpp
- !wince: LIBS += -lshell32
+ LIBS += -lshell32
}
load(qt_installs)
@@ -33,5 +33,3 @@ TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end
load(qt_targets)
load(qt_build_paths)
load(qt_common)
-
-wince: QMAKE_POST_LINK =