Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [ActiveX] Does not work event-loop inside of axserver
Forum Updated to NodeBB v4.3 + New Features

[ActiveX] Does not work event-loop inside of axserver

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kuzulis
    Qt Champions 2020
    wrote on 30 Jul 2014, 12:18 last edited by
    #1

    Hi all.

    I have a task to create AxServer in the form of dll which will be used by the some native Windows system client.

    But I have a problem where Qt event-loop doesn't work for successor of the QAxBindable class;
    e.g. the QTimer event do not comes..

    @
    class QTimer;
    class ControlEngine : public QWidget, public QAxBindable
    {
    Q_OBJECT
    public:
    ControlEngine::ControlEngine(QWidget *parent)
    : QWidget(parent)
    , timer(new QTimer(this))
    {
    qDebug() << Q_FUNC_INFO;

        connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
        timer->start(1000);
    }
    
    ControlEngine::~ControlEngine()
    {
        qDebug() << Q_FUNC_INFO;
    }
    
    QAxAggregated *ControlEngine::createAggregate()
    {
        qDebug() << Q_FUNC_INFO;
        return new ProviderImpl();
    }
    

    private slots:
    void timeout()
    {
    qDebug() << Q_FUNC_INFO;
    }

    private:
    QPointer<QTimer> timer;
    };

    QAXFACTORY_DEFAULT(
    ControlEngine,
    "{FCF395FC-B5AB-40A9-B632-09693DF21D86}",
    "{7595D4E0-E01B-4CC1-B330-60CEB6463C32}",
    "{23036F7F-A62E-4169-8B38-5E8D27BEE44F}",
    "{B4E43B7C-8473-4849-898C-7DC81DAE656B}",
    "{CEF5A233-1EDF-41E8-B6AC-B6888116A80A}"
    )
    @

    Further, I correctly register the server in the Registry (it really so).
    And to make some steps to launch of the "native" Windows client to use of my dll-server.

    From the "DebugView ":http://technet.microsoft.com/en-us/sysinternals/bb896647.aspxutility I see that all
    COM-interfaces works successfully:

    • ControlEngine::ControlEngine(class QWidget *)
    • ControlEngine::createAggregate(void)
    • ProviderImpl::ProviderImpl(void)
    • ProviderImpl::queryInterface(const class QUuid &,void **) , iid: QUuid("{d27c3481-5a1c-45b2-8aaa-c20ebbe8229e}")
    • ProviderImpl::queryInterface(const class QUuid &,void **) , iid: QUuid("{d27c3481-5a1c-45b2-8aaa-c20ebbe8229e}")
    • ProviderImpl::SetUsageScenario(enum _CREDENTIAL_PROVIDER_USAGE_SCENARIO,unsigned long) , scenario 2
    • ProviderImpl::Advise(struct ICredentialProviderEvents *,__w64 unsigned int)
    • ProviderImpl::UnAdvise(void)
    • ProviderImpl::GetCredentialCount(unsigned long *,unsigned long *,int *)
    • ProviderImpl::GetCredentialAt(unsigned long,struct ICredentialProviderCredential **)
    • ProviderImpl::QueryInterface(const struct _GUID &,void **) , iid: QUuid("{63913a93-40c1-481a-818d-4072ff8c70cc}")
    • ProviderImpl::GetFieldDescriptorCount(unsigned long *)
    • ProviderImpl::GetFieldDescriptorAt(unsigned long,struct _CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR **)
    • CredentialImpl::GetStringValue(unsigned long,wchar_t **)
    • CredentialImpl::GetFieldState(unsigned long,enum _CREDENTIAL_PROVIDER_FIELD_STATE *,enum _CREDENTIAL_PROVIDER_FIELD_INTERACTIVE_STATE *)

    BUT! I don't see the logs from the QTimer signal/slots.. What happens? How to fix it?

    BR,
    Denis

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on 31 Jul 2014, 10:02 last edited by
      #2

      I'm find out a some solution. Need to install an additional hook on WH_GETMESSAGE, where in their callback do qApp->processEvents().

      @
      static LRESULT QT_WIN_CALLBACK msgHookProc(int nCode, WPARAM wParam, LPARAM lParam)
      {
      if (qApp)
      qApp->processEvents();
      return ::CallNextHookEx(msg_hook, nCode, wParam, lParam);
      }

      ControlEngine::ControlEngine(QWidget *parent)
      : QWidget(parent)
      , timer(new QTimer(this))
      {
      qDebug() << Q_FUNC_INFO;

      msg_hook = ::SetWindowsHookEx(WH_GETMESSAGE, msgHookProc, 0, ::GetCurrentThreadId());
      qDebug() << Q_FUNC_INFO << "msg_hook" << msg_hook;
      
      QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
      timer->start(1000);
      

      }

      ControlEngine::~ControlEngine()
      {
      if (msg_hook)
      ::UnhookWindowsHookEx(msg_hook);

      qDebug() << Q_FUNC_INFO;
      

      }
      @

      The interesting moment that in ActiveQt also present a hook on WH_GETMESSAGE. But there in callback twitches the qApp->sendPostedEvents().

      Thus, it seems it is necessary to have two Hook. I don't know as it works - but it works. :)

      1 Reply Last reply
      0

      1/2

      30 Jul 2014, 12:18

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved