QT calls IDL under Visual Studio

Source: Internet
Author: User
Tags qt designer

A Brief introduction:

1.ActiveQt contains Qaxcontainer and qaxserver components.

1) Qaxcontainer allows COM objects to be used, and ActiveX controls can be embedded in the QT program.

Qaxcontainer is made up of three classes. respectively:

Qaxobject Encapsulation of COM objects

Qaxwidget Encapsulation of ActiveX controls

Qaxbase is the parent class of Qaxobject and Qaxwidget, which implements the core function of encapsulating com.

You can get and set the properties of an ActiveX control by calling the property () method of Qaxwidget and the SetProperty method.

Calling the ActiveX control's Method property requires a conversion of the data type in COM and the data type in QT. A table that corresponds to the data type in COM and the data type in QT:

2) Qaxserver can export the QT control we wrote as a COM object or an ActiveX control.

3) A simple example:

#include <QApplication> #include <QtGui> #include <QAxWidget> int main (int argc, char *argv[])      {    qapplication A (argc, argv);    Qaxwidget *flash = new Qaxwidget (0,0);    Flash->resize (500,80);    Flash->setcontrol (Qstring::fromutf8 ("{d27cdb6e-ae6d-11cf-96b8-444553540000}"));   Flash->dynamiccall ("Loadmovie (long,string)", 0, "f:/1.swf");    Flash->show ();       return A.exec (); }

  

Two Method

1. First register Idldrawx3.ocx in Windows

Go to cmd and enter the following command: (note the trailing path with double quotes)

regsvr32 "C:\Program files\itt\idl\idl81\bin\bin.x86\idldrawx3.ocx"

ActiveX is called in 2.Qt:

1) The Qaxwidget is placed on the interface through the QT designer;

2) Right-click Settings control;

3) Select the ActiveX controls registered in the System Idldrawwidget control 3.0;

4) If ACTIVEQT support is not added to the project, you can QT->QT project SETTINGS->QT Modules and then tick ACTIVEQT container support, if it is a Qt Creator project, You need it in the. Pro file
Added: CONFIG + = Qaxcontainer

3. The invocation of an interface in ActiveX, implemented by Dynamiccall ();

Dynamiccall () passes a parameter of up to eight qvariant types, and the return type is also qvariant.

QT calls IDL under Visual Studio

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.