Results 1 to 5 of 5

Thread: ActiveX events and Qt

  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default ActiveX events and Qt

    I'm trying to use the Skype4COM library in a Qt application. Now with dumpcpp I've created the h and cpp file.
    I can collect User in my friends list and make a call but I don't know how I could receive events from Skype itself.
    Watching the generated header file I found this:
    // skipping event interface _ISkypeEvents
    and is probably not a good sign. Does anyone know how I could get the (Skype) events working? If I do it in C# it is fairly easiliy but I want it in Qt.

    Further more when using my (basic) application I get a segmentation fault when exiting my app. Am I missing something do destroy the ActiveX component?
    Qt Code:
    1. delete m_Skype;
    To copy to clipboard, switch view to plain text mode 
    doesn't get rid of the segmentation fault.

    Some code:
    header:
    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include <QAxObject>
    6. #include "skype4comlib.h"
    7.  
    8. using namespace SKYPE4COMLib;
    9.  
    10. namespace Ui {
    11. class MainWindow;
    12. }
    13.  
    14. class MainWindow : public QMainWindow
    15. {
    16. Q_OBJECT
    17.  
    18. public:
    19. explicit MainWindow(QWidget *parent = 0);
    20. ~MainWindow();
    21.  
    22. private:
    23. Ui::MainWindow* m_UI;
    24. Skype* m_Skype;
    25.  
    26. };
    27.  
    28. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    the cpp:
    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. #include <QDebug>
    4.  
    5. MainWindow::MainWindow(QWidget *parent) :
    6. QMainWindow(parent),
    7. m_UI(new Ui::MainWindow)
    8. {
    9. m_UI->setupUi(this);
    10.  
    11. m_Skype = new Skype();
    12. m_Skype->Attach(6, true);
    13. //m_Skype->SetSilentMode(true);
    14.  
    15. IUserCollection* friends = m_Skype->Friends();
    16.  
    17. for (int i = 1; i <= friends->Count(); i++)
    18. {
    19. IUser* user = friends->Item(i);
    20. qDebug() << i << ":" << user->FullName();
    21. }
    22. }
    23.  
    24. MainWindow::~MainWindow()
    25. {
    26. delete m_UI;
    27. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ActiveX events and Qt

    Would using a QAxWidget and/or loading the dll directly instead of using dumpcpp help?

  3. #3
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ActiveX events and Qt

    I found out that qAxBase has already an event sink:

    Qt Code:
    1. connect(m_Skype, SIGNAL(signal(QString,int,void*)), SLOT(Sink(QString,int,void*)));
    To copy to clipboard, switch view to plain text mode 

    Now I receive the events but the signatures differ from the Skype Documentation
    By calling I get a
    Qt Code:
    1. "CallStatus(IDispatch*,TCallStatus)"
    To copy to clipboard, switch view to plain text mode 
    as name. But in documentation it should be
    Qt Code:
    1. HRESULT CallStatus([in] ICall* pCall, [in] TCallStatus Status);
    To copy to clipboard, switch view to plain text mode 

    If I connect to the IDispatch, the connect will fail. If I connect to the ICall interface I don't get a msg in output(==succesfull) but events will not be send to that slot...

  4. #4
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ActiveX events and Qt

    I can receive the CallStatus using the sink but the parameters are incorrect. Casting the first parameter (IDispatch) is not working either.
    Connecting to "CallStatus(IDispatch*,TCallStatus)" will fail because the signal could not be found.
    Qt Code:
    1. m_Skype = new Skype();
    2. m_Skype->Attach(5, true);
    3. connect(m_Skype, SIGNAL(signal(QString,int,void*)), SLOT(Sink(QString,int,void*)));
    4. connect(m_Skype, SIGNAL(ContactsFocused(QString)), SLOT(ContactsFocused(QString)));
    5. connect(m_Skype, SIGNAL(CallStatus(ICall*,TCallStatus)), SLOT(CallStatus(ICall*,TCallStatus)));
    6.  
    7. void SkypeWrapper::ContactsFocused(QString name)
    8. {
    9. qDebug() << "ContactsFocused:" << name; // <- Called!
    10. }
    11.  
    12. void SkypeWrapper::CallStatus(ICall* pCall, TCallStatus Status)
    13. {
    14. qDebug() << "CallStatus(ICall):"; // <- Never called
    15. }
    16.  
    17. void SkypeWrapper::Sink(const QString& name, int argc, void * argv)
    18. {
    19. qDebug() << "sink: name(" << name << ") argc(" << argc<< ")";
    20.  
    21. VARIANTARG* params = (VARIANTARG*)argv;
    22.  
    23. if (name.startsWith("CallStatus"))
    24. {
    25. //According to Qt the arguments are in reverse order
    26. IDispatch* dis = params[argc-1].pdispVal;
    27. ICall* call = (ICall*)dis;
    28. dis.Answer(); // <- Segmentation fault
    29. }
    30. }
    To copy to clipboard, switch view to plain text mode 

    It works for ContactsFocussed:
    sink: name( "Reply(IDispatch*)" ) argc( 1 )
    Object::receivers: No such signal SKYPE4COMLib::skype::Reply(IDispatch*)
    sink: name( "ContactsFocused(QString)" ) argc( 1 )
    ContactsFocused: "echo123" // <- Works!
    But not for CallStatus:
    sink: name( "Reply(IDispatch*)" ) argc( 1 )
    Object::receivers: No such signal SKYPE4COMLib::skype::Reply(IDispatch*)
    sink: name( "CallStatus(IDispatch*,TCallStatus)" ) argc( 2 ) //<- This should be CallStatus(ICall*,TCallStatus)
    Object::receivers: No such signal SKYPE4COMLib::skype::CallStatus(IDispatch*,TCallSt atus)
    sink: name( "Reply(IDispatch*)" ) argc( 1 )
    Object::receivers: No such signal SKYPE4COMLib::skype::Reply(IDispatch*)
    sink: name( "CallStatus(IDispatch*,TCallStatus)" ) argc( 2 )
    Object::receivers: No such signal SKYPE4COMLib::skype::CallStatus(IDispatch*,TCallSt atus)
    If I use the dumpinfo function I get:
    OBJECT SKYPE4COMLib::skype::unnamed
    SIGNALS OUT
    //Snip
    signal: CallStatus(ICall*,TCallStatus)
    --> SkypeWrapper::SkypeWrapperCallStatus(ICall*,TCallS tatus)
    //Snip
    signal: ContactsFocused(QString)
    --> SkypeWrapper::SkypeWrapperContactsFocused(QString)
    //Snip
    signal: signal(QString,int,void*)
    --> SkypeWrapper::SkypeWrapperSink(QString,int,void*)
    SIGNALS IN
    <None>
    Any ideas how to get the ICall* object?
    Last edited by rvdk; 27th April 2011 at 13:32.

  5. #5
    Join Date
    Aug 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ActiveX events and Qt

    I was just wondering if you were ever able to solve this problem. I'm using a different library, but am getting similar error messages...

    Thanks

Similar Threads

  1. how to use WMI and ACTIVEX in Qt
    By sarang_neo in forum Newbie
    Replies: 5
    Last Post: 13th April 2011, 10:34
  2. ActiveX
    By franco.amato in forum Qt Programming
    Replies: 6
    Last Post: 29th December 2009, 17:06
  3. WMP ActiveX
    By tamad in forum Qt Programming
    Replies: 4
    Last Post: 22nd October 2007, 21:01
  4. ActiveX control
    By Kapil in forum General Discussion
    Replies: 0
    Last Post: 4th October 2006, 09:56
  5. How can i use ActiveX
    By mmg123 in forum Qt Tools
    Replies: 6
    Last Post: 3rd October 2006, 11:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.