diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/activeqt/container/qaxbase.cpp | 58 | ||||
-rw-r--r-- | src/activeqt/container/qaxdump.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/container/qaxobject.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/container/qaxscript.cpp | 22 | ||||
-rw-r--r-- | src/activeqt/container/qaxselect.cpp | 34 | ||||
-rw-r--r-- | src/activeqt/container/qaxwidget.cpp | 56 | ||||
-rw-r--r-- | src/activeqt/control/qaxfactory.cpp | 12 | ||||
-rw-r--r-- | src/activeqt/control/qaxserver.cpp | 18 | ||||
-rw-r--r-- | src/activeqt/control/qaxserverbase.cpp | 173 | ||||
-rw-r--r-- | src/activeqt/control/qaxserverdll.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/control/qaxservermain.cpp | 15 | ||||
-rw-r--r-- | src/activeqt/shared/qaxtypes.cpp | 13 |
12 files changed, 147 insertions, 266 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 62dad6b..4fc9926 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -39,10 +39,6 @@ //#define QAX_NO_CLASSINFO -#ifndef UNICODE -#define UNICODE -#endif - #define QT_CHECK_STATE #include "qaxobject.h" @@ -174,7 +170,7 @@ inline DISPID QAxMetaObject::dispIDofName(const QByteArray &name, IDispatch *dis if (dispid == DISPID_UNKNOWN) { // get the Dispatch ID from the object QString unicodeName = QLatin1String(name); - OLECHAR *names = (TCHAR*)unicodeName.utf16(); + OLECHAR *names = (wchar_t*)unicodeName.utf16(); disp->GetIDsOfNames(IID_NULL, &names, 1, LOCALE_USER_DEFAULT, &dispid); if (dispid != DISPID_UNKNOWN) dispIDs.insert(name, dispid); @@ -638,7 +634,7 @@ QByteArray QAxEventSink::findProperty(DISPID dispID) UINT cNames; typeinfo->GetNames(dispID, &names, 1, &cNames); if (cNames) { - propname = QString::fromUtf16((const ushort *)names).toLatin1(); + propname = QString::fromWCharArray(names).toLatin1(); SysFreeString(names); } typeinfo->Release(); @@ -972,7 +968,7 @@ bool QAxBase::setControl(const QString &c) QUuid uuid(search); if (uuid.isNull()) { CLSID clsid; - HRESULT res = CLSIDFromProgID((WCHAR*)c.utf16(), &clsid); + HRESULT res = CLSIDFromProgID((wchar_t*)c.utf16(), &clsid); if (res == S_OK) search = QUuid(clsid).toString(); else { @@ -1137,7 +1133,7 @@ QStringList QAxBase::verbs() const while (enumVerbs->Next(1, &verb, &c) == S_OK) { if (!verb.lpszVerbName) continue; - QString verbName = QString::fromUtf16((const ushort *)verb.lpszVerbName); + QString verbName = QString::fromWCharArray(verb.lpszVerbName); if (!verbName.isEmpty()) d->verbs.insert(verbName, verb.lVerb); } @@ -1265,7 +1261,7 @@ bool QAxBase::initializeLicensedHelper(void *f, const QString &key, IUnknown **p } else if (licinfo.fRuntimeKeyAvail) { BSTR licenseKey; factory2->RequestLicKey(0, &licenseKey); - QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey); + QString qlicenseKey = QString::fromWCharArray(licenseKey); SysFreeString(licenseKey); qWarning("Use license key is '%s' to create object on unlicensed machine.", qlicenseKey.toLatin1().constData()); @@ -1275,7 +1271,7 @@ bool QAxBase::initializeLicensedHelper(void *f, const QString &key, IUnknown **p if (licinfo.fRuntimeKeyAvail) { BSTR licenseKey; factory2->RequestLicKey(0, &licenseKey); - QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey); + QString qlicenseKey = QString::fromWCharArray(licenseKey); SysFreeString(licenseKey); if (qlicenseKey != key) @@ -1435,7 +1431,7 @@ bool QAxBase::initializeRemote(IUnknown** ptr) serverInfo.dwReserved1 = 0; serverInfo.dwReserved2 = 0; serverInfo.pAuthInfo = &authInfo; - serverInfo.pwszName = (WCHAR*)server.utf16(); + serverInfo.pwszName = (wchar_t*)server.utf16(); IClassFactory *factory = 0; HRESULT res = CoGetClassObject(QUuid(clsid), CLSCTX_REMOTE_SERVER, &serverInfo, IID_IClassFactory, (void**)&factory); @@ -1747,7 +1743,7 @@ QMetaObject *qax_readInterfaceInfo(ITypeLib *typeLib, ITypeInfo *typeInfo, const if (S_OK != typeInfo->GetDocumentation(-1, &bstr, 0, 0, 0)) return 0; - className = QString::fromUtf16((const ushort *)bstr); + className = QString::fromWCharArray(bstr); SysFreeString(bstr); generator.readEnumInfo(); @@ -1768,7 +1764,7 @@ QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *classInfo, const QM if (S_OK != classInfo->GetDocumentation(-1, &bstr, 0, 0, 0)) return 0; - className = QString::fromUtf16((const ushort *)bstr); + className = QString::fromWCharArray(bstr); SysFreeString(bstr); generator.readEnumInfo(); @@ -1795,7 +1791,7 @@ QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *classInfo, const QM continue; interfaceInfo->GetDocumentation(-1, &bstr, 0, 0, 0); - QString interfaceName = QString::fromUtf16((const ushort *)bstr); + QString interfaceName = QString::fromWCharArray(bstr); SysFreeString(bstr); QByteArray key; @@ -1843,7 +1839,7 @@ MetaObjectGenerator::MetaObjectGenerator(ITypeLib *tlib, ITypeInfo *tinfo) typelib->AddRef(); BSTR bstr; typelib->GetDocumentation(-1, &bstr, 0, 0, 0); - current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1(); + current_typelib = QString::fromWCharArray(bstr).toLatin1(); SysFreeString(bstr); } readClassInfo(); @@ -1891,13 +1887,13 @@ QByteArray MetaObjectGenerator::usertypeToString(const TYPEDESC &tdesc, ITypeInf // get type library name BSTR typelibname = 0; usertypelib->GetDocumentation(-1, &typelibname, 0, 0, 0); - QByteArray typeLibName = QString::fromUtf16((const ushort *)typelibname).toLatin1(); + QByteArray typeLibName = QString::fromWCharArray(typelibname).toLatin1(); SysFreeString(typelibname); // get type name BSTR usertypename = 0; usertypelib->GetDocumentation(index, &usertypename, 0, 0, 0); - QByteArray userTypeName = QString::fromUtf16((const ushort *)usertypename).toLatin1(); + QByteArray userTypeName = QString::fromWCharArray(usertypename).toLatin1(); SysFreeString(usertypename); if (hasEnum(userTypeName)) // known enum? @@ -2287,7 +2283,7 @@ void MetaObjectGenerator::readEnumInfo() BSTR enumname; QByteArray enumName; if (typelib->GetDocumentation(i, &enumname, 0, 0, 0) == S_OK) { - enumName = QString::fromUtf16((const ushort *)enumname).toLatin1(); + enumName = QString::fromWCharArray(enumname).toLatin1(); SysFreeString(enumname); } else { enumName = "enum" + QByteArray::number(++enum_serial); @@ -2310,7 +2306,7 @@ void MetaObjectGenerator::readEnumInfo() UINT maxNamesOut; enuminfo->GetNames(memid, &valuename, 1, &maxNamesOut); if (maxNamesOut) { - valueName = QString::fromUtf16((const ushort *)valuename).toLatin1(); + valueName = QString::fromWCharArray(valuename).toLatin1(); SysFreeString(valuename); } else { valueName = "value" + QByteArray::number(valueindex++); @@ -2467,7 +2463,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) QList<QByteArray> names; int p; for (p = 0; p < (int)maxNamesOut; ++p) { - names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1(); + names << QString::fromWCharArray(bstrNames[p]).toLatin1(); SysFreeString(bstrNames[p]); } @@ -2594,7 +2590,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) // get function documentation BSTR bstrDocu; info->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0); - QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); + QString strDocu = QString::fromWCharArray(bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) desc += '[' + strDocu + ']'; @@ -2641,7 +2637,7 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars) QByteArray variableName; uint flags = 0; - variableName = QString::fromUtf16((const ushort *)bstrName).toLatin1(); + variableName = QString::fromWCharArray(bstrName).toLatin1(); SysFreeString(bstrName); // get variable type @@ -2677,7 +2673,7 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars) // get function documentation BSTR bstrDocu; info->GetDocumentation(vardesc->memid, 0, &bstrDocu, 0, 0); - QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); + QString strDocu = QString::fromWCharArray(bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) desc += '[' + strDocu + ']'; @@ -2800,7 +2796,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo QList<QByteArray> names; int p; for (p = 0; p < (int)maxNamesOut; ++p) { - names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1(); + names << QString::fromWCharArray(bstrNames[p]).toLatin1(); SysFreeString(bstrNames[p]); } @@ -2824,7 +2820,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo // get function documentation BSTR bstrDocu; eventinfo->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0); - QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); + QString strDocu = QString::fromWCharArray(bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) desc += '[' + strDocu + ']'; @@ -2982,7 +2978,7 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co if (typelib) { BSTR bstr; typelib->GetDocumentation(-1, &bstr, 0, 0, 0); - current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1(); + current_typelib = QString::fromWCharArray(bstr).toLatin1(); SysFreeString(bstr); } if (d->tryCache && tryCache()) @@ -3391,9 +3387,9 @@ static bool checkHRESULT(HRESULT hres, EXCEPINFO *exc, QAxBase *that, const QStr exc->pfnDeferredFillIn(exc); code = exc->wCode ? exc->wCode : exc->scode; - source = QString::fromUtf16((const ushort *)exc->bstrSource); - desc = QString::fromUtf16((const ushort *)exc->bstrDescription); - help = QString::fromUtf16((const ushort *)exc->bstrHelpFile); + source = QString::fromWCharArray(exc->bstrSource); + desc = QString::fromWCharArray(exc->bstrDescription); + help = QString::fromWCharArray(exc->bstrHelpFile); uint helpContext = exc->dwHelpContext; if (helpContext && !help.isEmpty()) @@ -4228,7 +4224,7 @@ public: if (!var) return E_POINTER; - QString property = QString::fromUtf16((const ushort *)name); + QString property = QString::fromWCharArray(name); QVariant qvar = map.value(property); QVariantToVARIANT(qvar, *var); return S_OK; @@ -4237,7 +4233,7 @@ public: { if (!var) return E_POINTER; - QString property = QString::fromUtf16((const ushort *)name); + QString property = QString::fromWCharArray(name); QVariant qvar = VARIANTToQVariant(*var, 0); map[property] = qvar; diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp index 39d5121..a654a8f 100644 --- a/src/activeqt/container/qaxdump.cpp +++ b/src/activeqt/container/qaxdump.cpp @@ -66,8 +66,8 @@ QString qax_docuFromName(ITypeInfo *typeInfo, const QString &name) BSTR docStringBstr, helpFileBstr; ulong helpContext; HRESULT hres = typeInfo->GetDocumentation(memId, 0, &docStringBstr, &helpContext, &helpFileBstr); - QString docString = QString::fromUtf16((const ushort *)docStringBstr); - QString helpFile = QString::fromUtf16((const ushort *)helpFileBstr); + QString docString = QString::fromWCharArray(docStringBstr); + QString helpFile = QString::fromWCharArray(helpFileBstr); SysFreeString(docStringBstr); SysFreeString(helpFileBstr); if (hres == S_OK) { diff --git a/src/activeqt/container/qaxobject.cpp b/src/activeqt/container/qaxobject.cpp index 3526f93..412c5b5 100644 --- a/src/activeqt/container/qaxobject.cpp +++ b/src/activeqt/container/qaxobject.cpp @@ -37,10 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - #include "qaxobject.h" #ifndef QT_NO_WIN_ACTIVEQT diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index dcfc84b..2ee08b3 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -37,10 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - #include "qaxscript.h" #ifndef QT_NO_WIN_ACTIVEQT @@ -194,7 +190,7 @@ HRESULT WINAPI QAxScriptSite::GetItemInfo(LPCOLESTR pstrName, DWORD mask, IUnkno else if (mask & SCRIPTINFO_ITYPEINFO) return E_POINTER; - QAxBase *object = script->findObject(QString::fromUtf16((const ushort*)pstrName)); + QAxBase *object = script->findObject(QString::fromWCharArray(pstrName)); if (!object) return TYPE_E_ELEMENTNOTFOUND; @@ -236,9 +232,9 @@ HRESULT WINAPI QAxScriptSite::OnScriptTerminate(const VARIANT *result, const EXC emit script->finished(VARIANTToQVariant(*result, 0)); if (exception) emit script->finished(exception->wCode, - QString::fromUtf16((const ushort*)exception->bstrSource), - QString::fromUtf16((const ushort*)exception->bstrDescription), - QString::fromUtf16((const ushort*)exception->bstrHelpFile) + QString::fromWCharArray(exception->bstrSource), + QString::fromWCharArray(exception->bstrDescription), + QString::fromWCharArray(exception->bstrHelpFile) ); return S_OK; } @@ -287,14 +283,14 @@ HRESULT WINAPI QAxScriptSite::OnScriptError(IActiveScriptError *error) error->GetSourcePosition(&context, &lineNumber, &charPos); HRESULT hres = error->GetSourceLineText(&bstrLineText); if (hres == S_OK) { - lineText = QString::fromUtf16((const ushort*)bstrLineText); + lineText = QString::fromWCharArray(bstrLineText); SysFreeString(bstrLineText); } SysFreeString(exception.bstrSource); SysFreeString(exception.bstrDescription); SysFreeString(exception.bstrHelpFile); - emit script->error(exception.wCode, QString::fromUtf16((const ushort*)exception.bstrDescription), lineNumber, lineText); + emit script->error(exception.wCode, QString::fromWCharArray(exception.bstrDescription), lineNumber, lineText); return S_OK; } @@ -463,7 +459,7 @@ bool QAxScriptEngine::initialize(IUnknown **ptr) return false; CLSID clsid; - HRESULT hres = CLSIDFromProgID((WCHAR*)script_language.utf16(), &clsid); + HRESULT hres = CLSIDFromProgID((wchar_t*)script_language.utf16(), &clsid); if(FAILED(hres)) return false; @@ -609,7 +605,7 @@ void QAxScriptEngine::addItem(const QString &name) if (!engine) return; - engine->AddNamedItem((WCHAR*)name.utf16(), SCRIPTITEM_ISSOURCE|SCRIPTITEM_ISVISIBLE); + engine->AddNamedItem((wchar_t*)name.utf16(), SCRIPTITEM_ISSOURCE|SCRIPTITEM_ISVISIBLE); #endif } @@ -1173,7 +1169,7 @@ bool QAxScriptManager::registerEngine(const QString &name, const QString &extens return false; CLSID clsid; - HRESULT hres = CLSIDFromProgID((WCHAR*)name.utf16(), &clsid); + HRESULT hres = CLSIDFromProgID((wchar_t*)name.utf16(), &clsid); if (hres != S_OK) return false; diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp index 5de39e4..a0c725d 100644 --- a/src/activeqt/container/qaxselect.cpp +++ b/src/activeqt/container/qaxselect.cpp @@ -52,54 +52,46 @@ public: : QAbstractListModel(parent) { HKEY classes_key; - QT_WA_INLINE( - RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &classes_key), - RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &classes_key)); + RegOpenKeyEx(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &classes_key); if (!classes_key) return; DWORD index = 0; LONG result = 0; - TCHAR buffer[256]; - DWORD szBuffer = sizeof(buffer); + wchar_t buffer[256]; + DWORD szBuffer = sizeof(buffer) / sizeof(wchar_t); FILETIME ft; do { - result = QT_WA_INLINE( - RegEnumKeyExW(classes_key, index, (wchar_t*)&buffer, &szBuffer, 0, 0, 0, &ft), - RegEnumKeyExA(classes_key, index, (char*)&buffer, &szBuffer, 0, 0, 0, &ft)); - szBuffer = sizeof(buffer); + result = RegEnumKeyEx(classes_key, index, buffer, &szBuffer, 0, 0, 0, &ft); + szBuffer = sizeof(buffer) / sizeof(wchar_t); if (result == ERROR_SUCCESS) { HKEY sub_key; - QString clsid = QT_WA_INLINE(QString::fromUtf16((ushort*)buffer), QString::fromLocal8Bit((char*)buffer)); - result = QT_WA_INLINE( - RegOpenKeyExW(classes_key, reinterpret_cast<const wchar_t *>(QString(clsid + "\\Control").utf16()), 0, KEY_READ, &sub_key), - RegOpenKeyA(classes_key, QString(clsid + QLatin1String("\\Control")).toLocal8Bit(), &sub_key)); + QString clsid = QString::fromWCharArray(buffer); + result = RegOpenKeyEx(classes_key, reinterpret_cast<const wchar_t *>(QString(clsid + "\\Control").utf16()), 0, KEY_READ, &sub_key); if (result == ERROR_SUCCESS) { RegCloseKey(sub_key); - QT_WA_INLINE( - RegistryQueryValueW(classes_key, buffer, (LPBYTE)buffer, &szBuffer), - RegQueryValueA(classes_key, (char*)buffer, (char*)buffer, (LONG*)&szBuffer)); - QString name = QT_WA_INLINE(QString::fromUtf16((ushort*)buffer, szBuffer / sizeof(TCHAR)) , QString::fromLocal8Bit((char*)buffer, szBuffer)); + RegistryQueryValue(classes_key, buffer, (LPBYTE)buffer, &szBuffer); + QString name = QString::fromWCharArray(buffer); controls << name; clsids.insert(name, clsid); } result = ERROR_SUCCESS; } - szBuffer = sizeof(buffer); + szBuffer = sizeof(buffer) / sizeof(wchar_t); ++index; } while (result == ERROR_SUCCESS); RegCloseKey(classes_key); controls.sort(); } - LONG RegistryQueryValueW(HKEY hKey, LPCWSTR lpSubKey, LPBYTE lpData, LPDWORD lpcbData) + LONG RegistryQueryValue(HKEY hKey, LPCWSTR lpSubKey, LPBYTE lpData, LPDWORD lpcbData) { LONG ret = ERROR_FILE_NOT_FOUND; HKEY hSubKey = NULL; - RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, &hSubKey); + RegOpenKeyEx(hKey, lpSubKey, 0, KEY_READ, &hSubKey); if (hSubKey) { - ret = RegQueryValueExW(hSubKey, 0, 0, 0, lpData, lpcbData); + ret = RegQueryValueEx(hSubKey, 0, 0, 0, lpData, lpcbData); RegCloseKey(hSubKey); } return ret; diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index ebec872..615887f 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -37,11 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - - #include "qaxwidget.h" #ifndef QT_NO_WIN_ACTIVEQT @@ -470,7 +465,7 @@ static QAbstractEventDispatcher::EventFilter previous_filter = 0; #if defined(Q_WS_WINCE) static int filter_ref = 0; #else -static const char *qaxatom = "QAxContainer4_Atom"; +static const wchar_t *qaxatom = L"QAxContainer4_Atom"; #endif // The filter procedure listening to user interaction on the control @@ -714,7 +709,7 @@ bool QAxClientSite::activateObject(bool initialized, const QByteArray &data) BSTR userType; HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType); if (result == S_OK) { - widget->setWindowTitle(QString::fromUtf16((const ushort *)userType)); + widget->setWindowTitle(QString::fromWCharArray(userType)); CoTaskMemFree(userType); } } else { @@ -984,10 +979,7 @@ HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModif eventTranslated = false; if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam) return S_OK; - QT_WA_INLINE( - SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam), - SendMessageA(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam) - ); + SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam); return S_OK; } @@ -1173,15 +1165,15 @@ HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPW #endif } -static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &text, QPixmap &/*icon*/) +static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &/*icon*/) { if (item.fType == MFT_STRING && item.cch) { - char *titlebuf = new char[item.cch+1]; + wchar_t *titlebuf = new wchar_t[item.cch + 1]; item.dwTypeData = titlebuf; item.cch++; - ::GetMenuItemInfoA(menu, index, true, &item); - text = QString::fromLocal8Bit(titlebuf); - delete []titlebuf; + ::GetMenuItemInfo(menu, index, true, &item); + text = QString::fromWCharArray(titlebuf); + delete [] titlebuf; return MFT_STRING; } #if 0 @@ -1191,7 +1183,7 @@ static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &tex GetBitmapDimensionEx(hbm, &bmsize); QPixmap pixmap(1,1); QSize sz(MAP_LOGHIM_TO_PIX(bmsize.cx, pixmap.logicalDpiX()), - MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); + MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); pixmap.resize(bmsize.cx, bmsize.cy); if (!pixmap.isNull()) { @@ -1215,11 +1207,11 @@ QMenu *QAxClientSite::generatePopup(HMENU subMenu, QWidget *parent) if (count) popup = new QMenu(parent); for (int i = 0; i < count; ++i) { - MENUITEMINFOA item; - memset(&item, 0, sizeof(MENUITEMINFOA)); - item.cbSize = sizeof(MENUITEMINFOA); + MENUITEMINFO item; + memset(&item, 0, sizeof(MENUITEMINFO)); + item.cbSize = sizeof(MENUITEMINFO); item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; - ::GetMenuItemInfoA(subMenu, i, true, &item); + ::GetMenuItemInfo(subMenu, i, true, &item); QAction *action = 0; QMenu *popupMenu = 0; @@ -1295,11 +1287,11 @@ HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND int count = GetMenuItemCount(hmenuShared); for (int i = 0; i < count; ++i) { - MENUITEMINFOA item; - memset(&item, 0, sizeof(MENUITEMINFOA)); - item.cbSize = sizeof(MENUITEMINFOA); + MENUITEMINFO item; + memset(&item, 0, sizeof(MENUITEMINFO)); + item.cbSize = sizeof(MENUITEMINFO); item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; - ::GetMenuItemInfoA(hmenuShared, i, true, &item); + ::GetMenuItemInfo(hmenuShared, i, true, &item); QAction *action = 0; QMenu *popupMenu = 0; @@ -1379,7 +1371,7 @@ int QAxClientSite::qt_metacall(QMetaObject::Call call, int isignal, void **argv) OleMenuItem oleItem = menuItemMap.value(action); if (oleItem.hMenu) - ::PostMessageA(m_menuOwner, WM_COMMAND, oleItem.id, 0); + ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0); return -1; #endif } @@ -1404,7 +1396,7 @@ HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/) HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText) { - QStatusTipEvent tip(QString::fromUtf16((const ushort *)(BSTR)pszStatusText)); + QStatusTipEvent tip(QString::fromWCharArray(pszStatusText)); QApplication::sendEvent(widget, &tip); return S_OK; } @@ -1513,7 +1505,7 @@ HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveOb AX_DEBUG(QAxClientSite::SetActiveObject); if (pszObjName && widget) - widget->setWindowTitle(QString::fromUtf16((const ushort *)(BSTR)pszObjName)); + widget->setWindowTitle(QString::fromWCharArray(pszObjName)); if (m_spInPlaceActiveObject) { if (!inPlaceModelessEnabled) @@ -1952,12 +1944,12 @@ bool QAxWidget::createHostWindow(bool initialized, const QByteArray &data) container->activateObject(initialized, data); #if !defined(Q_OS_WINCE) - ATOM filter_ref = FindAtomA(qaxatom); + ATOM filter_ref = FindAtom(qaxatom); #endif if (!filter_ref) previous_filter = QAbstractEventDispatcher::instance()->setEventFilter(axc_FilterProc); #if !defined(Q_OS_WINCE) - AddAtomA(qaxatom); + AddAtom(qaxatom); #else ++filter_ref; #endif @@ -1992,10 +1984,10 @@ void QAxWidget::clear() return; if (!control().isEmpty()) { #if !defined(Q_OS_WINCE) - ATOM filter_ref = FindAtomA(qaxatom); + ATOM filter_ref = FindAtom(qaxatom); if (filter_ref) DeleteAtom(filter_ref); - filter_ref = FindAtomA(qaxatom); + filter_ref = FindAtom(qaxatom); if (!filter_ref) { #else if (!filter_ref && !--filter_ref) { 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; diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index 916fcca..49aa99c 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -37,11 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - - #include <ocidl.h> #include <olectl.h> @@ -123,7 +118,7 @@ static QFont IFontToQFont(IFont *f) f->get_Strikethrough(&strike); f->get_Underline(&underline); f->get_Weight(&weight); - QFont font(QString::fromUtf16((const ushort *)name), size.Lo/9750, weight / 97, italic); + QFont font(QString::fromWCharArray(name), size.Lo/9750, weight / 97, italic); font.setBold(bold); font.setStrikeOut(strike); font.setUnderline(underline); @@ -925,10 +920,10 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint QVariant var; switch(arg.vt) { case VT_BSTR: - var = QString::fromUtf16((const ushort *)arg.bstrVal); + var = QString::fromWCharArray(arg.bstrVal); break; case VT_BSTR|VT_BYREF: - var = QString::fromUtf16((const ushort *)*arg.pbstrVal); + var = QString::fromWCharArray(*arg.pbstrVal); break; case VT_BOOL: var = QVariant((bool)arg.boolVal); @@ -1245,7 +1240,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint for (long i = lBound; i <= uBound; ++i) { BSTR bstr; SafeArrayGetElement(array, &i, &bstr); - strings << QString::fromUtf16((const ushort *)bstr); + strings << QString::fromWCharArray(bstr); SysFreeString(bstr); } |