Results 1 to 3 of 3

Thread: how to make these contents work??

  1. #1
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default how to make these contents work??

    Hi

    thanks for help so far.

    I am trying to contact a dll through a Qt application and I have gone through the Qt documentation.

    I have built a UI which has 2 push buttons and 1 text box. One push button is used to load the dll and copy its return value the other to paste the return value. The ui_dll.h contains the following.

    /************************************************** ******************************
    ** Form generated from reading ui file 'dll.ui'
    **
    ** Created: Mon Mar 2 18:19:03 2009
    ** by: Qt User Interface Compiler version 4.4.3
    **
    ** WARNING! All changes made in this file will be lost when recompiling ui file!
    ************************************************** ******************************/

    #ifndef UI_DLL_H
    #define UI_DLL_H

    #include <QtCore/QVariant>
    #include <QtGui/QAction>
    #include <QtGui/QApplication>
    #include <QtGui/QButtonGroup>
    #include <QtGui/QPushButton>
    #include <QtGui/QTextEdit>
    #include <QtGui/QWidget>

    QT_BEGIN_NAMESPACE

    class Ui_Form
    {
    public:
    QPushButton *pushButton;
    QPushButton *pushButton_2;
    QTextEdit *textEdit;

    void setupUi(QWidget *Form)
    {
    if (Form->objectName().isEmpty())
    Form->setObjectName(QString::fromUtf8("Form"));
    Form->resize(384, 227);
    pushButton = new QPushButton(Form);
    pushButton->setObjectName(QString::fromUtf8("pushButton"));
    pushButton->setGeometry(QRect(110, 30, 171, 23));
    pushButton_2 = new QPushButton(Form);
    pushButton_2->setObjectName(QString::fromUtf8("pushButton_2") );
    pushButton_2->setGeometry(QRect(110, 80, 171, 23));
    textEdit = new QTextEdit(Form);
    textEdit->setObjectName(QString::fromUtf8("textEdit"));
    textEdit->setGeometry(QRect(110, 130, 171, 71));
    pushButton->raise();
    pushButton_2->raise();
    textEdit->raise();

    retranslateUi(Form);
    QObject::connect(pushButton_2, SIGNAL(clicked()), textEdit, SLOT(paste()));

    QMetaObject::connectSlotsByName(Form);
    } // setupUi

    void retranslateUi(QWidget *Form)
    {
    Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8));
    pushButton->setText(QApplication::translate("Form", "Load DLL", 0, QApplication::UnicodeUTF8));
    pushButton_2->setText(QApplication::translate("Form", "Paste the contents", 0, QApplication::UnicodeUTF8));
    Q_UNUSED(Form);
    } // retranslateUi

    };

    namespace Ui {
    class Form: public Ui_Form {};
    } // namespace Ui

    QT_END_NAMESPACE

    #endif // UI_DLL_H
    I have built a dll.cpp file. it has the following contents

    QLibrary myLib("dllprog");
    typedef void (*MyPrototype)();
    MyPrototype TestDLL =
    (MyPrototype) QLibrary::resolve("dllprog", "mysymbol");
    if (TestDLL)
    char a =TestDLL();
    I still havent written the code to get the return value from the variable "a" and return it to the text box.

    main.cpp has the following

    #include "ui_dll.h"

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QWidget *widget = new QWidget;
    Ui:ll ui;
    ui.setupUi(widget);

    widget->show();
    return app.exec();
    }
    I have built the .pro file as follows.

    CONFIG += qt
    FORMS += dll.ui
    SOURCES += dll.cpp \
    main.cpp
    I would appreciate if you can help me complete the code and get the app working. I am new to Qt and finding it difficult at the moment. I have a working prototype which I built in VC++. I need a platform independent app and hence Qt.

    what next should i do to built the app which can contact the dll and get the job done.??

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to make these contents work??

    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: how to make these contents work??

    thanks for replying. I have built my own dll.

    What i need from my app is that it should contact the dll, get the return value(a string in this case) and show it in the text box.

    how can this be accomplished?

Similar Threads

  1. how to make Window+M key work for my application
    By yxmaomao in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2008, 00:35
  2. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 14:43
  3. can't make QAbstractItemView signals work
    By ber_44 in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2007, 07:29
  4. how to make QHttp work with this URL
    By ber_44 in forum Qt Programming
    Replies: 11
    Last Post: 23rd April 2007, 09:20
  5. Why can't I make dynamic_cast work properly?
    By pir in forum General Programming
    Replies: 13
    Last Post: 18th July 2006, 16:17

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.