[Solved] MFC application using DLL created by Qt



  • Now I want to use some Qt widgets at my own MFC app.
    I am prohibited to change my Development tool(VS8) and use ActiveX control(QAxObject),
    so I want to use Qt widgets as Library( i.e *.dll).

    Please teach me wheather is it possible?

    If it is possible, I want to do the same thing at Solaris application.



  • You want to have a look at the Qt-MFC migration framework in QtSolutions
    "http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Windows/qtwinmigrate/":http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Windows/qtwinmigrate/

    This has information on how to use Qt widgets in a Win32 application.

    The main problem is the event loop - the MFC application handles the events so Qt widgets won't get them. AFAIK the Qt-MFC framework provides the classes for synchronizing the event loops so that your Qt widgets will get Qt events.

    [edit: fixed link]



  • Thank Mr.David for sending me good information.

    QWinWidget is interesting!
    But I met the trouble using QWinWidget.

    About qtwinmigrate-2.8_1-opensource, I have two questions.

    At install.txt "3. Building the component and examples "
    g++ is required. But g++ is not found.
    My setup(vista) seems to be wrong?

    From QtCreator, I open buildlib.pro and build library.

    By VC++2008 Express, I add two header
    <QWinWidget>,<QMessageBox> at my MFC app.

    At BOOL InitInstance(HINSTANCE hInstance, int nCmdShow),
    I write simple the following simple code:
    QWinWidget qwin(hWnd);
    qwin.center();
    QMessageBox::information(&qwin, "Caption", "Information Text");

    int argc = 0;
    QApplication a( argc, 0 );

    return a.exec();

    But I met the following error
    error LNK2019: "__declspec(dllimport) public: virtual __thiscall QWinWidget::~QWinWidget(void)"

    I apologize my lack of skills, but if it is possible, could you advise?



  • hi david, can you convert the url text to a link



  • When I compiled Qt by VC2008express, I didn’t meet above trouble.

    So This problem was solved for me^^;
    .


Log in to reply
 

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