summaryrefslogtreecommitdiffstats
path: root/src/activeqt/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/activeqt/control')
-rw-r--r--src/activeqt/control/qaxfactory.cpp12
-rw-r--r--src/activeqt/control/qaxserver.cpp18
-rw-r--r--src/activeqt/control/qaxserverbase.cpp173
-rw-r--r--src/activeqt/control/qaxserverdll.cpp4
-rw-r--r--src/activeqt/control/qaxservermain.cpp15
5 files changed, 68 insertions, 154 deletions
diff --git a/src/activeqt/control/qaxfactory.cpp b/src/activeqt/control/qaxfactory.cpp
index c65fbb8..742e93e 100644
--- a/src/activeqt/control/qaxfactory.cpp
+++ b/src/activeqt/control/qaxfactory.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
/*!
\class QAxFactory
@@ -277,7 +277,7 @@ bool QAxFactory::validateLicenseKey(const QString &key, const QString &licenseKe
return true;
if (licenseKey.isEmpty()) {
- QString licFile(QFile::decodeName(qAxModuleFilename));
+ QString licFile(QString::fromWCharArray(qAxModuleFilename));
int lastDot = licFile.lastIndexOf(QLatin1Char('.'));
licFile = licFile.left(lastDot) + QLatin1String(".lic");
if (QFile::exists(licFile))
@@ -360,7 +360,7 @@ bool QAxFactory::isServer()
return qAxIsServer;
}
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
/*!
Returns the directory that contains the server binary.
@@ -372,7 +372,7 @@ extern char qAxModuleFilename[MAX_PATH];
*/
QString QAxFactory::serverDirPath()
{
- return QFileInfo(QString::fromLocal8Bit(qAxModuleFilename)).absolutePath();
+ return QFileInfo(QString::fromWCharArray(qAxModuleFilename)).absolutePath();
}
/*!
@@ -384,7 +384,7 @@ QString QAxFactory::serverDirPath()
*/
QString QAxFactory::serverFilePath()
{
- return QString::fromLocal8Bit(qAxModuleFilename);
+ return QString::fromWCharArray(qAxModuleFilename);
}
/*!
@@ -492,7 +492,7 @@ bool QAxFactory::registerActiveObject(QObject *object)
if (qstricmp(object->metaObject()->classInfo(object->metaObject()->indexOfClassInfo("RegisterObject")).value(), "yes"))
return false;
- if (!QString::fromLocal8Bit(qAxModuleFilename).toLower().endsWith(QLatin1String(".exe")))
+ if (!QString::fromWCharArray(qAxModuleFilename).toLower().endsWith(QLatin1String(".exe")))
return false;
ActiveObject *active = new ActiveObject(object, qAxFactory());
diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp
index a9b3271..e6b0c17 100644
--- a/src/activeqt/control/qaxserver.cpp
+++ b/src/activeqt/control/qaxserver.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
bool qAxIsServer = false;
HANDLE qAxInstance = 0;
ITypeLib *qAxTypeLibrary = 0;
-char qAxModuleFilename[MAX_PATH];
+wchar_t qAxModuleFilename[MAX_PATH];
bool qAxOutProcServer = false;
// The QAxFactory instance
@@ -116,19 +116,19 @@ QString qAxInit()
InitializeCriticalSection(&qAxModuleSection);
- libFile = QString::fromLocal8Bit(qAxModuleFilename);
+ libFile = QString::fromWCharArray(qAxModuleFilename);
libFile = libFile.toLower();
- if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
+ if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
return libFile;
int lastDot = libFile.lastIndexOf(QLatin1Char('.'));
libFile = libFile.left(lastDot) + QLatin1String(".tlb");
- if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
+ if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
return libFile;
lastDot = libFile.lastIndexOf(QLatin1Char('.'));
libFile = libFile.left(lastDot) + QLatin1String(".olb");
- if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
+ if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK)
return libFile;
libFile = QString();
@@ -207,7 +207,7 @@ QString qax_clean_type(const QString &type, const QMetaObject *mo)
HRESULT UpdateRegistry(BOOL bRegister)
{
qAxIsServer = false;
- QString file = QString::fromLocal8Bit(qAxModuleFilename);
+ QString file = QString::fromWCharArray(qAxModuleFilename);
QString path = file.left(file.lastIndexOf(QLatin1Char('\\'))+1);
QString module = file.right(file.length() - path.length());
module = module.left(module.lastIndexOf(QLatin1Char('.')));
@@ -229,7 +229,7 @@ HRESULT UpdateRegistry(BOOL bRegister)
typeLibVersion = QString::number((uint)major) + QLatin1Char('.') + QString::number((uint)minor);
if (bRegister)
- RegisterTypeLib(qAxTypeLibrary, (TCHAR*)libFile.utf16(), 0);
+ RegisterTypeLib(qAxTypeLibrary, (wchar_t*)libFile.utf16(), 0);
else
UnRegisterTypeLib(libAttr->guid, libAttr->wMajorVerNum, libAttr->wMinorVerNum, libAttr->lcid, libAttr->syskind);
@@ -1071,7 +1071,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver)
QFile file(outfile);
file.remove();
- QString filebase = QString::fromLocal8Bit(qAxModuleFilename);
+ QString filebase = QString::fromWCharArray(qAxModuleFilename);
filebase = filebase.left(filebase.lastIndexOf(QLatin1Char('.')));
QString appID = qAxFactory()->appID().toString().toUpper();
@@ -1107,7 +1107,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver)
out << "/****************************************************************************" << endl;
out << "** Interface definition generated for ActiveQt project" << endl;
out << "**" << endl;
- out << "** '" << qAxModuleFilename << '\'' << endl;
+ out << "** '" << QString::fromWCharArray(qAxModuleFilename) << '\'' << endl;
out << "**" << endl;
out << "** Created: " << QDateTime::currentDateTime().toString() << endl;
out << "**" << endl;
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 2cac004..d7a8e07 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -788,17 +788,9 @@ bool qax_winEventFilter(void *message)
QAxServerBase *axbase = 0;
while (!axbase && baseHwnd) {
#ifdef GWLP_USERDATA
- QT_WA({
- axbase = (QAxServerBase*)GetWindowLongPtrW(baseHwnd, GWLP_USERDATA);
- }, {
- axbase = (QAxServerBase*)GetWindowLongPtrA(baseHwnd, GWLP_USERDATA);
- });
+ axbase = (QAxServerBase*)GetWindowLongPtr(baseHwnd, GWLP_USERDATA);
#else
- QT_WA({
- axbase = (QAxServerBase*)GetWindowLongW(baseHwnd, GWL_USERDATA);
- }, {
- axbase = (QAxServerBase*)GetWindowLongA(baseHwnd, GWL_USERDATA);
- });
+ axbase = (QAxServerBase*)GetWindowLong(baseHwnd, GWL_USERDATA);
#endif
baseHwnd = ::GetParent(baseHwnd);
@@ -905,11 +897,7 @@ public:
// hook into eventloop; this allows a server to create his own QApplication object
if (!qax_hhook && qax_ownQApp) {
- QT_WA({
- qax_hhook = SetWindowsHookExW(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
- }, {
- qax_hhook = SetWindowsHookExA(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
- });
+ qax_hhook = SetWindowsHookEx(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
}
HRESULT res;
@@ -983,7 +971,7 @@ public:
HRESULT WINAPI CreateInstanceLic(IUnknown *pUnkOuter, IUnknown *pUnkReserved, REFIID iid, BSTR bKey, PVOID *ppObject)
{
- QString licenseKey = QString::fromUtf16((const ushort *)bKey);
+ QString licenseKey = QString::fromWCharArray(bKey);
if (!qAxFactory()->validateLicenseKey(className, licenseKey))
return CLASS_E_NOTLICENSED;
return CreateInstanceHelper(pUnkOuter, iid, ppObject);
@@ -1303,15 +1291,11 @@ bool QAxServerBase::internalCreate()
internalBind();
if (isWidget) {
- if (!stayTopLevel) {
- QEvent e(QEvent::EmbeddingControl);
- QApplication::sendEvent(qt.widget, &e);
- QT_WA({
- ::SetWindowLongW(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- }, {
- ::SetWindowLongA(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- });
- }
+ if (!stayTopLevel) {
+ QEvent e(QEvent::EmbeddingControl);
+ QApplication::sendEvent(qt.widget, &e);
+ ::SetWindowLong(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ }
qt.widget->setAttribute(Qt::WA_QuitOnClose, false);
qt.widget->move(0, 0);
@@ -1368,52 +1352,26 @@ class HackWidget : public QWidget
LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_CREATE) {
- QAxServerBase *that;
- QT_WA({
- CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam;
- that = (QAxServerBase*)cs->lpCreateParams;
- }, {
- CREATESTRUCTA *cs = (CREATESTRUCTA*)lParam;
- that = (QAxServerBase*)cs->lpCreateParams;
- });
+ CREATESTRUCT *cs = (CREATESTRUCT*)lParam;
+ QAxServerBase *that = (QAxServerBase*)cs->lpCreateParams;
#ifdef GWLP_USERDATA
- QT_WA({
- SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)that);
- }, {
- SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)that);
- });
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)that);
#else
- QT_WA({
- SetWindowLongW(hWnd, GWL_USERDATA, (LONG)that);
- }, {
- SetWindowLongA(hWnd, GWL_USERDATA, (LONG)that);
- });
+ SetWindowLong(hWnd, GWL_USERDATA, (LONG)that);
#endif
- that->m_hWnd = hWnd;
+ that->m_hWnd = hWnd;
- QT_WA({
- return ::DefWindowProcW(hWnd, uMsg, wParam, lParam);
- }, {
- return ::DefWindowProcA(hWnd, uMsg, wParam, lParam);
- });
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
QAxServerBase *that = 0;
#ifdef GWLP_USERDATA
- QT_WA({
- that = (QAxServerBase*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
- }, {
- that = (QAxServerBase*)GetWindowLongPtrA(hWnd, GWLP_USERDATA);
- });
+ that = (QAxServerBase*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
#else
- QT_WA({
- that = (QAxServerBase*)GetWindowLongW(hWnd, GWL_USERDATA);
- }, {
- that = (QAxServerBase*)GetWindowLongA(hWnd, GWL_USERDATA);
- });
+ that = (QAxServerBase*)GetWindowLong(hWnd, GWL_USERDATA);
#endif
if (that) {
@@ -1563,11 +1521,7 @@ LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam,
}
}
- QT_WA({
- return ::DefWindowProcW(hWnd, uMsg, wParam, lParam);
- }, {
- return ::DefWindowProcA(hWnd, uMsg, wParam, lParam);
- });
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
/*!
@@ -1583,54 +1537,29 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos)
QString cn(QLatin1String("QAxControl"));
cn += QString::number((int)ActiveXProc);
if (!atom) {
- QT_WA({
- WNDCLASSW wcTemp;
- wcTemp.style = CS_DBLCLKS;
- wcTemp.cbClsExtra = 0;
- wcTemp.cbWndExtra = 0;
- wcTemp.hbrBackground = 0;
- wcTemp.hCursor = 0;
- wcTemp.hIcon = 0;
- wcTemp.hInstance = hInst;
- wcTemp.lpszClassName = (wchar_t*)cn.utf16();
- wcTemp.lpszMenuName = 0;
- wcTemp.lpfnWndProc = ActiveXProc;
-
- atom = RegisterClassW(&wcTemp);
- }, {
- QByteArray cna = cn.toLatin1();
- WNDCLASSA wcTemp;
- wcTemp.style = CS_DBLCLKS;
- wcTemp.cbClsExtra = 0;
- wcTemp.cbWndExtra = 0;
- wcTemp.hbrBackground = 0;
- wcTemp.hCursor = 0;
- wcTemp.hIcon = 0;
- wcTemp.hInstance = hInst;
- wcTemp.lpszClassName = cna.data();
- wcTemp.lpszMenuName = 0;
- wcTemp.lpfnWndProc = ActiveXProc;
-
- atom = RegisterClassA(&wcTemp);
- });
+ WNDCLASS wcTemp;
+ wcTemp.style = CS_DBLCLKS;
+ wcTemp.cbClsExtra = 0;
+ wcTemp.cbWndExtra = 0;
+ wcTemp.hbrBackground = 0;
+ wcTemp.hCursor = 0;
+ wcTemp.hIcon = 0;
+ wcTemp.hInstance = hInst;
+ wcTemp.lpszClassName = (wchar_t*)cn.utf16();
+ wcTemp.lpszMenuName = 0;
+ wcTemp.lpfnWndProc = ActiveXProc;
+
+ atom = RegisterClass(&wcTemp);
}
LeaveCriticalSection(&createWindowSection);
if (!atom && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
return 0;
Q_ASSERT(!m_hWnd);
- HWND hWnd = 0;
- QT_WA({
- hWnd = ::CreateWindowW((wchar_t*)cn.utf16(), 0,
- WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- rcPos.left, rcPos.top, rcPos.right - rcPos.left,
- rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this);
- }, {
- hWnd = ::CreateWindowA(cn.toLatin1().data(), 0,
- WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- rcPos.left, rcPos.top, rcPos.right - rcPos.left,
- rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this);
- });
+ HWND hWnd = ::CreateWindow((wchar_t*)cn.utf16(), 0,
+ WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ rcPos.left, rcPos.top, rcPos.right - rcPos.left,
+ rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this);
Q_ASSERT(m_hWnd == hWnd);
@@ -1676,11 +1605,7 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu)
actionMap.remove(itemId);
actionMap.insert(itemId, action);
}
- QT_WA({
- AppendMenuW(popupMenu, flags, itemId, (TCHAR*)action->text().utf16());
- }, {
- AppendMenuA(popupMenu, flags, itemId, action->text().toLocal8Bit());
- });
+ AppendMenu(popupMenu, flags, itemId, (const wchar_t *)action->text().utf16());
}
if (oldMenu)
DrawMenuBar(hwndMenuOwner);
@@ -1726,11 +1651,7 @@ void QAxServerBase::createMenu(QMenuBar *menuBar)
itemId = static_cast<ushort>(reinterpret_cast<ulong>(action));
actionMap.insert(itemId, action);
}
- QT_WA({
- AppendMenuW(hmenuShared, flags, itemId, (TCHAR*)action->text().utf16());
- } , {
- AppendMenuA(hmenuShared, flags, itemId, action->text().toLocal8Bit());
- });
+ AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16());
}
OLEMENUGROUPWIDTHS menuWidths = {0,edit,0,object,0,help};
@@ -2397,7 +2318,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid,
if (!cname)
return res;
- name = QString::fromUtf16((const ushort *)bname).toLatin1();
+ name = QString::fromWCharArray(bname).toLatin1();
SysFreeString(bname);
}
}
@@ -2799,7 +2720,7 @@ HRESULT WINAPI QAxServerBase::Load(IStream *pStm)
bool openAsText = false;
QByteArray qtarray;
if (hres == S_OK) {
- QString streamName = QString::fromUtf16((const ushort *)stat.pwcsName);
+ QString streamName = QString::fromWCharArray(stat.pwcsName);
CoTaskMemFree(stat.pwcsName);
openAsText = streamName == QLatin1String("SomeStreamName");
if (stat.cbSize.HighPart) // more than 4GB - too large!
@@ -2940,7 +2861,7 @@ HRESULT WINAPI QAxServerBase::Load(IStorage *pStg)
*/
streamName += QLatin1String("_Stream4.2");
- pStg->OpenStream((const WCHAR *)streamName.utf16(), 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream);
+ pStg->OpenStream((const wchar_t *)streamName.utf16(), 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream);
if (!spStream) // support for streams saved with 4.1 and earlier
pStg->OpenStream(L"SomeStreamName", 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream);
if (!spStream)
@@ -2963,7 +2884,7 @@ HRESULT WINAPI QAxServerBase::Save(IStorage *pStg, BOOL fSameAsLoad)
*/
streamName += QLatin1String("_Stream4.2");
- pStg->CreateStream((const WCHAR *)streamName.utf16(), STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &spStream);
+ pStg->CreateStream((const wchar_t *)streamName.utf16(), STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &spStream);
if (!spStream)
return E_FAIL;
@@ -3079,7 +3000,7 @@ HRESULT WINAPI QAxServerBase::SaveCompleted(LPCOLESTR fileName)
if (qt.object->metaObject()->indexOfClassInfo("MIME") == -1)
return E_NOTIMPL;
- currentFileName = QString::fromUtf16(reinterpret_cast<const ushort *>(fileName));
+ currentFileName = QString::fromWCharArray(fileName);
return S_OK;
}
@@ -3097,7 +3018,7 @@ HRESULT WINAPI QAxServerBase::GetCurFile(LPOLESTR *currentFile)
if (!malloc)
return E_OUTOFMEMORY;
- *currentFile = static_cast<WCHAR *>(malloc->Alloc(currentFileName.length() * 2));
+ *currentFile = static_cast<wchar_t *>(malloc->Alloc(currentFileName.length() * 2));
malloc->Release();
memcpy(*currentFile, currentFileName.unicode(), currentFileName.length() * 2);
@@ -3117,7 +3038,7 @@ HRESULT WINAPI QAxServerBase::Load(LPCOLESTR fileName, DWORD mode)
return E_NOTIMPL;
}
- QString loadFileName = QString::fromUtf16(reinterpret_cast<const ushort *>(fileName));
+ QString loadFileName = QString::fromWCharArray(fileName);
QString fileExtension = loadFileName.mid(loadFileName.lastIndexOf(QLatin1Char('.')) + 1);
QFile file(loadFileName);
@@ -3162,7 +3083,7 @@ HRESULT WINAPI QAxServerBase::Save(LPCOLESTR fileName, BOOL fRemember)
return E_NOTIMPL;
}
- QString saveFileName = QString::fromUtf16(reinterpret_cast<const ushort *>(fileName));
+ QString saveFileName = QString::fromWCharArray(fileName);
QString fileExtension = saveFileName.mid(saveFileName.lastIndexOf(QLatin1Char('.')) + 1);
QFile file(saveFileName);
@@ -3220,7 +3141,7 @@ HRESULT WINAPI QAxServerBase::Draw(DWORD dwAspect, LONG lindex, void *pvAspect,
bool bDeleteDC = false;
if (!hicTargetDev) {
- hicTargetDev = ::CreateDCA("DISPLAY", NULL, NULL, NULL);
+ hicTargetDev = ::CreateDC(L"DISPLAY", NULL, NULL, NULL);
bDeleteDC = (hicTargetDev != hdcDraw);
}
@@ -3383,7 +3304,7 @@ HRESULT WINAPI QAxServerBase::OnAmbientPropertyChange(DISPID dispID)
case DISPID_AMBIENT_DISPLAYNAME:
if (var.vt != VT_BSTR || !isWidget)
break;
- qt.widget->setWindowTitle(QString::fromUtf16((const ushort *)var.bstrVal));
+ qt.widget->setWindowTitle(QString::fromWCharArray(var.bstrVal));
break;
case DISPID_AMBIENT_FONT:
if (var.vt != VT_DISPATCH || !isWidget)
diff --git a/src/activeqt/control/qaxserverdll.cpp b/src/activeqt/control/qaxserverdll.cpp
index 375028d..512c408 100644
--- a/src/activeqt/control/qaxserverdll.cpp
+++ b/src/activeqt/control/qaxserverdll.cpp
@@ -50,7 +50,7 @@ bool qax_ownQApp = false;
HHOOK qax_hhook = 0;
// in qaxserver.cpp
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
extern bool qAxIsServer;
extern ITypeLib *qAxTypeLibrary;
extern unsigned long qAxLockCount();
@@ -120,7 +120,7 @@ STDAPI DllCanUnloadNow()
EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved)
{
- GetModuleFileNameA(hInstance, qAxModuleFilename, MAX_PATH-1);
+ GetModuleFileName(hInstance, qAxModuleFilename, MAX_PATH);
qAxInstance = hInstance;
qAxIsServer = true;
diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp
index 8f20d97..d465746 100644
--- a/src/activeqt/control/qaxservermain.cpp
+++ b/src/activeqt/control/qaxservermain.cpp
@@ -66,7 +66,7 @@ extern bool qAxActivity;
extern HANDLE qAxInstance;
extern bool qAxIsServer;
extern bool qAxOutProcServer;
-extern char qAxModuleFilename[MAX_PATH];
+extern wchar_t qAxModuleFilename[MAX_PATH];
extern QString qAxInit();
extern void qAxCleanup();
extern HRESULT UpdateRegistry(BOOL bRegister);
@@ -105,7 +105,7 @@ static DWORD WINAPI MonitorProc(void* pv)
static bool StartMonitor()
{
dwThreadID = GetCurrentThreadId();
- hEventShutdown = CreateEventA(0, false, false, 0);
+ hEventShutdown = CreateEvent(0, false, false, 0);
if (hEventShutdown == 0)
return false;
DWORD dwThreadID;
@@ -203,17 +203,10 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR,
QT_USE_NAMESPACE
qAxOutProcServer = true;
- GetModuleFileNameA(0, qAxModuleFilename, MAX_PATH-1);
+ GetModuleFileName(0, qAxModuleFilename, MAX_PATH);
qAxInstance = hInstance;
- QByteArray cmdParam;
- QT_WA({
- LPTSTR cmdline = GetCommandLineW();
- cmdParam = QString::fromUtf16((const ushort *)cmdline).toLocal8Bit();
- }, {
- cmdParam = GetCommandLineA();
- });
-
+ QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit();
QList<QByteArray> cmds = cmdParam.split(' ');
QByteArray unprocessed;