src/activeqt/control/qaxserverbase.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   158     HWND create(HWND hWndParent, RECT& rcPos);
   158     HWND create(HWND hWndParent, RECT& rcPos);
   159     HMENU createPopup(QMenu *popup, HMENU oldMenu = 0);
   159     HMENU createPopup(QMenu *popup, HMENU oldMenu = 0);
   160     void createMenu(QMenuBar *menuBar);
   160     void createMenu(QMenuBar *menuBar);
   161     void removeMenu();
   161     void removeMenu();
   162 
   162 
   163     static LRESULT CALLBACK ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
   163     static LRESULT QT_WIN_CALLBACK ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
   164 
   164 
   165 // Object registration with OLE
   165 // Object registration with OLE
   166     void registerActiveObject(IUnknown *object);
   166     void registerActiveObject(IUnknown *object);
   167     void revokeActiveObject();
   167     void revokeActiveObject();
   168 
   168 
   762     CRITICAL_SECTION refCountSection;
   762     CRITICAL_SECTION refCountSection;
   763     unsigned long ref;
   763     unsigned long ref;
   764 };
   764 };
   765 
   765 
   766 // callback for DLL server to hook into non-Qt eventloop
   766 // callback for DLL server to hook into non-Qt eventloop
   767 LRESULT CALLBACK axs_FilterProc(int nCode, WPARAM wParam, LPARAM lParam)
   767 LRESULT QT_WIN_CALLBACK axs_FilterProc(int nCode, WPARAM wParam, LPARAM lParam)
   768 {
   768 {
   769     if (qApp && !invokeCount)
   769     if (qApp && !invokeCount)
   770         qApp->sendPostedEvents();
   770         qApp->sendPostedEvents();
   771 
   771 
   772     return CallNextHookEx(qax_hhook, nCode, wParam, lParam);
   772     return CallNextHookEx(qax_hhook, nCode, wParam, lParam);
  1348     \i WM_MOUSEACTIVATE The ActiveX is activated
  1348     \i WM_MOUSEACTIVATE The ActiveX is activated
  1349     \endlist
  1349     \endlist
  1350 
  1350 
  1351     The semantics of \a wParam and \a lParam depend on the value of \a uMsg.
  1351     The semantics of \a wParam and \a lParam depend on the value of \a uMsg.
  1352 */
  1352 */
  1353 LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  1353 LRESULT QT_WIN_CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  1354 {
  1354 {
  1355     if (uMsg == WM_CREATE) {
  1355     if (uMsg == WM_CREATE) {
  1356         CREATESTRUCT *cs = (CREATESTRUCT*)lParam;
  1356         CREATESTRUCT *cs = (CREATESTRUCT*)lParam;
  1357         QAxServerBase *that = (QAxServerBase*)cs->lpCreateParams;
  1357         QAxServerBase *that = (QAxServerBase*)cs->lpCreateParams;
  1358 
  1358 
  1534 
  1534 
  1535     static ATOM atom = 0;
  1535     static ATOM atom = 0;
  1536     HINSTANCE hInst = (HINSTANCE)qAxInstance;
  1536     HINSTANCE hInst = (HINSTANCE)qAxInstance;
  1537     EnterCriticalSection(&createWindowSection);
  1537     EnterCriticalSection(&createWindowSection);
  1538     QString cn(QLatin1String("QAxControl"));
  1538     QString cn(QLatin1String("QAxControl"));
  1539     cn += QString::number((int)ActiveXProc);
  1539     cn += QString::number((quintptr)ActiveXProc);
  1540     if (!atom) {
  1540     if (!atom) {
  1541         WNDCLASS wcTemp;
  1541         WNDCLASS wcTemp;
  1542         wcTemp.style = CS_DBLCLKS;
  1542         wcTemp.style = CS_DBLCLKS;
  1543         wcTemp.cbClsExtra = 0;
  1543         wcTemp.cbClsExtra = 0;
  1544         wcTemp.cbWndExtra = 0;
  1544         wcTemp.cbWndExtra = 0;
  1597             flags |= MF_CHECKED;
  1597             flags |= MF_CHECKED;
  1598 
  1598 
  1599 	ushort itemId;
  1599 	ushort itemId;
  1600         if (flags & MF_POPUP) {
  1600         if (flags & MF_POPUP) {
  1601             itemId = static_cast<ushort>(
  1601             itemId = static_cast<ushort>(
  1602                 reinterpret_cast<ulong>(createPopup(action->menu()))
  1602                 reinterpret_cast<quintptr>(createPopup(action->menu()))
  1603             );
  1603             );
  1604         } else {
  1604         } else {
  1605             itemId = static_cast<ushort>(reinterpret_cast<ulong>(action));
  1605             itemId = static_cast<ushort>(reinterpret_cast<quintptr>(action));
  1606             actionMap.remove(itemId);
  1606             actionMap.remove(itemId);
  1607             actionMap.insert(itemId, action);
  1607             actionMap.insert(itemId, action);
  1608         }
  1608         }
  1609         AppendMenu(popupMenu, flags, itemId, (const wchar_t *)action->text().utf16());
  1609         AppendMenu(popupMenu, flags, itemId, (const wchar_t *)action->text().utf16());
  1610     }
  1610     }
  1644 	    object++;
  1644 	    object++;
  1645 
  1645 
  1646 	ushort itemId;
  1646 	ushort itemId;
  1647         if (flags & MF_POPUP) {
  1647         if (flags & MF_POPUP) {
  1648             itemId = static_cast<ushort>(
  1648             itemId = static_cast<ushort>(
  1649                 reinterpret_cast<ulong>(createPopup(action->menu()))
  1649                 reinterpret_cast<quintptr>(createPopup(action->menu()))
  1650             );
  1650             );
  1651         } else {
  1651         } else {
  1652             itemId = static_cast<ushort>(reinterpret_cast<ulong>(action));
  1652             itemId = static_cast<ushort>(reinterpret_cast<quintptr>(action));
  1653             actionMap.insert(itemId, action);
  1653             actionMap.insert(itemId, action);
  1654         }
  1654         }
  1655         AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16());
  1655         AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16());
  1656     }
  1656     }
  1657 
  1657