From 390598cb4392bbf5f77e8a05578e190b1a9f544a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 9 Mar 2016 14:29:01 +0100 Subject: Winmain: Remove Windows CE. Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library. Task-number: QTBUG-51673 Change-Id: I473f215066db819a273f293940dcce9fe03152c3 Reviewed-by: Joerg Bornemann --- src/winmain/qtmain_win.cpp | 59 +--------------------------------------------- src/winmain/winmain.pro | 4 +--- 2 files changed, 2 insertions(+), 61 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 -#endif +#include /* 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 &); -#else extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector &); -#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 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 e8c9ace03b..828ef6cf5a 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -21,7 +21,7 @@ winrt { } else { SOURCES = qtmain_win.cpp - !wince: LIBS += -lshell32 + LIBS += -lshell32 } load(qt_installs) @@ -31,5 +31,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 = -- cgit v1.2.3