Results 1 to 3 of 3

Thread: How to use standard COM method to link a Qt GCC C++ .exe and a project in MVS C++?

  1. #1
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Question How to use standard COM method to link a Qt GCC C++ .exe and a project in MVS C++?

    How to use standard COM method to link a Qt GCC C++ .exe and a project in MVS C++?
    (Note: MVSC project code using class.)

    Fragment of the MVSC header file code which is supposed to be included in Qt project(filename:catDataPreparator.h):-
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    class catDataPreparator
    {
    public:
    // constructor
    __declspec(dllexport) catDataPreparator();

    // destructor
    __declspec(dllexport) ~catDataPreparator(void);

    // methods
    //=========
    // METHODS FOR GUI FORM
    __declspec(dllexport) void processInputData(const char*, const char* , const int, const float, const float, const int, const float, const float );
    -------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------
    mainwindow.h which is Qt project header file,where catDataPreparator.h is included, code as below:

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #pragma once

    #include <QMainWindow>
    #include <QPrinter>
    #include <QDialog>
    #include <QFrame>

    #include "mysharedlib_global.h"
    #include "catDataPreparator.h"

    QT_BEGIN_NAMESPACE
    class QCheckBox;
    class QAction;
    class QLabel;
    class QMenu;
    class QPlainTextEdit;
    class QListWidget;
    class QScrollArea;
    class QScrollBar;
    class QString;
    class QText;

    //external class//

    class catDataPreparator;

    QT_END_NAMESPACE

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    #ifdef widget
    MainWindow(QWidget *parent = 0);
    Dialog(QWidget *parent = 0);
    #endif
    MainWindow();

    protected:
    void closeEvent(QCloseEvent *event);

    private slots:
    void newFile();
    void openImageFile(); //open();
    void open();
    void openTextFile();

    bool save();
    bool saveAs();
    void about();
    void aboutCPT();

    void documentWasModified();
    void import();
    void importdialog();
    void trimdialog();
    void analysis1();

    void print();
    void zoomIn();
    void zoomOut();
    void normalSize();
    void fitToWindow();

    void setText();
    void setOpenFileName();
    void setFileName();
    void setCMRFileName();
    void setFrameNumber();
    void setEdEs();

    void newimport();


    private:
    void createActions();
    void createMenus();
    void createToolBars();
    void createStatusBar();
    void readSettings();
    void writeSettings();
    void createDockWindows();
    bool maybeSave();
    void loadFile(const QString &fileName);
    bool saveFile(const QString &fileName);
    void setCurrentFile(const QString &fileName);
    void showData(const QString &data);
    void showMessage(const QString &message);

    void updateActions();
    void scaleImage(double factor);
    void adjustScrollBar(QScrollBar *scrollBar, double factor);

    #ifndef QT_NO_PRINTER
    QPrinter printer;
    #endif
    QDialog *importwindow;
    QLabel *imageLabel;
    QText *text;
    QScrollArea *scrollArea;
    QPushButton *myButton;

    double scaleFactor;

    QString strippedName(const QString &fullFileName);
    QString curFile;
    QPlainTextEdit *textEdit;

    QListWidget *dirView;
    QListWidget *dataList;
    QListWidget *messageList;

    QMenu *fileMenu;
    QMenu *editMenu;
    QMenu *viewMenu;
    QMenu *dataMenu;
    QMenu *analysisMenu;
    QMenu *helpMenu;

    QToolBar *fileToolBar;
    QToolBar *editToolBar;

    QAction *newAct;
    QAction *openAct;
    QAction *openTextFileAct;

    QAction *saveAct;
    QAction *saveAsAct;
    QAction *exitAct;
    QAction *cutAct;
    QAction *copyAct;
    QAction *pasteAct;
    QAction *importAct;
    QAction *importdialogAct;
    QAction *trimdialogAct;
    QAction *filenameAct;
    QAction *framenumberAct;
    QAction *EdEsAct;

    QAction *aboutAct;
    QAction *aboutCPTAct;
    QAction *analysis1Act;
    QAction *analysis2Act;
    QAction *analysis3Act;
    QAction *printAct;
    QAction *fitToWindowAct;
    QAction *zoomInAct;
    QAction *zoomOutAct;
    QAction *normalSizeAct;
    QCheckBox *native;

    public:

    QLabel *questionLabel;
    QLabel *textLabel;
    QLabel *openFileNameLabel;
    QLabel *setFileNameLabel;
    QLabel *setFrameLabel;
    QLabel *setEdEsLabel;

    catDataPreparator dataPrep;
    };
    ---------------------------------------------------------------------------------------------------------------------------------------eom
    -S.O.S
    Last edited by babygal; 20th May 2010 at 03:38.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use standard COM method to link a Qt GCC C++ .exe and a project in MVS C++

    Howto, example, etc are all available here: http://msdn.microsoft.com/en-us/library/ms809986.aspx

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to use standard COM method to link a Qt GCC C++ .exe and a project in MVS C++

    babygal, please use [ code ] and [ /code] tags to enclose code. Makes it easier for everyone to read.

    If it is a COM object then you need to read the ActiveQt documentation. Usually it comes down to:
    • Run dumpcpp against the COM dll or ocx
    • Include the generated header and implementation in your Qt project.
    • Create an instance of the proxy object that dumpcpp has defined/implemented.

Similar Threads

  1. Replies: 3
    Last Post: 11th May 2010, 04:50
  2. How to link GLUT to Qt Project?
    By Lawand in forum Newbie
    Replies: 5
    Last Post: 20th March 2010, 20:29
  3. Replies: 1
    Last Post: 3rd December 2009, 23:34
  4. Replies: 2
    Last Post: 2nd June 2008, 08:45
  5. Question about standard shortcuts
    By y.shan in forum Qt Programming
    Replies: 5
    Last Post: 3rd December 2007, 15:05

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.