Cannot receive events from MS Word with Qt ActiveX framework



  • 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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.