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. Cannot receive events from MS Word with Qt ActiveX framework
Forum Updated to NodeBB v4.3 + New Features

Cannot receive events from MS Word with Qt ActiveX framework

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 938 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.
  • A Offline
    A Offline
    anagelcg
    wrote on last edited by
    #1

    I currently write a plugin in C++ with the Qt-Framework. I want to access a COM-interface via Qt-ActiveX-Framework. To test the framework, I created the C++ Wrapper-Classes for MS-Word with the Qt-tool 'dumpcpp.exe'. Now, I can start word, add a new document and insert some text. That's okay.

    Now I want to register some events like 'Quit' or 'DocumentOpen', etc. The code below shows the class I use with one public function 'generateDocument()' which starts word and adds a new document.

    @
    class WordTestApplication : public QObject
    {
    Q_OBJECT

    public:
    WordTestApplication();
    ~WordTestApplication();

    void generateDocument();
    

    public slots:
    void onQuit();

    private:
    Word::Application *word;
    };
    @

    The implementation of the generateDocument() function looks as follows. The word application is created and the Quit()-event is registered.

    @
    void WordTestApplication::generateDocument()
    {
    word = new Word::Application;
    connect(word, SIGNAL(Quit()), this, SLOT(onQuit()));
    word->SetVisible(true);
    word->Documents()->Add();
    }
    @

    In the 'onQuit()' slot I just want to show a message box for testing:

    @
    void WordTestApplication::onQuit()
    {
    QMessageBox::information(NULL, QString::fromLatin1("MESSAGE"), QString::fromLatin1("Quit"));
    }
    @

    The problem here is that the event is not catched in my implementation. What's wrong here? I couldn't find examples with MSWord and Qt's ActiveX-framework combined with COM-events. Can anybody help me, please? Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      anagelcg
      wrote on last edited by
      #2

      The problem here was that I used a wrong SIGNAL-signature. Now I can receive the events.

      1 Reply Last reply
      0

      • Login

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