|
1Qter豆
本帖最后由 zhkmxx930 于 2017-11-7 21:27 编辑
QT套件 5.7.1 + MinGW32 5.3.0版本
.pro文件配置如下
- #-------------------------------------------------
- #
- # Project created by QtCreator 2017-11-07T21:02:30
- #
- #-------------------------------------------------
- QT += core gui
- QT += axcontainer
- greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
- TARGET = testActivX
- TEMPLATE = app
- # The following define makes your compiler emit warnings if you use
- # any feature of Qt which as been marked as deprecated (the exact warnings
- # depend on your compiler). Please consult the documentation of the
- # deprecated API in order to know how to port your code away from it.
- DEFINES += QT_DEPRECATED_WARNINGS
- # You can also make your code fail to compile if you use deprecated APIs.
- # In order to do so, uncomment the following line.
- # You can also select to disable deprecated APIs only up to a certain version of Qt.
- #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
- SOURCES += main.cpp\
- mainwindow.cpp
- HEADERS += mainwindow.h
- FORMS += mainwindow.ui
复制代码
在main.cpp中直接调用QAxWidget
- #include "mainwindow.h"
- #include <QApplication>
- #include <QAxWidget>
- #include <QDebug>
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- QAxWidget *motor =new QAxWidget(0,0);
- motor->resize(600,500);
- qDebug()<<"before set control code";
- motor->setControl(QString::fromUtf8("{7EEBDE39-6447-41EC-89D8-94A754092050}"));
- motor->setWindowTitle("the motor of APT");
- const int SN=71864678;
- QVariant qsn(SN);
- qDebug()<<qsn;
- motor->setProperty("HWSerialNum",qsn);
- qDebug()<<motor->property("HWSerialNum");
- qDebug()<<"after set control code";
- motor->dynamicCall("StartCtrl()");
- motor->show();
- return a.exec();
- }
复制代码 结果编译出现错误
请问是什么原因
|
|