QtProcessExteriorExe把其他程序加载到Qt界面中
2023-09-14 08:57:11 时间
相关资料:
https://www.baidu.com/link?url=1uzHF_j5lIqL0FWbARNYLnV2pD1tDzbtcwE4KUsg5KkCUPO_Y3RBODMm-KqUEpu46leD-gVAxkEcL8W9FBR7k_&wd=&eqid=c020dd8c0011bef10000000260ab496e
https://blog.csdn.net/zhango5/article/details/80901674
https://blog.csdn.net/jiaoyaziyang/article/details/49802993
实例:
.pro
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 QT += core gui 2 3 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 5 CONFIG += c++11 6 7 # The following define makes your compiler emit warnings if you use 8 # any Qt feature that has been marked deprecated (the exact warnings 9 # depend on your compiler). Please consult the documentation of the 10 # deprecated API in order to know how to port your code away from it. 11 DEFINES += QT_DEPRECATED_WARNINGS 12 13 # You can also make your code fail to compile if it uses deprecated APIs. 14 # In order to do so, uncomment the following line. 15 # You can also select to disable deprecated APIs only up to a certain version of Qt. 16 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 17 18 SOURCES += \ 19 main.cpp \ 20 mainwindow.cpp 21 22 HEADERS += \ 23 mainwindow.h 24 25 FORMS += \ 26 mainwindow.ui 27 28 LIBS += -lUser32 29 30 # Default rules for deployment. 31 qnx: target.path = /tmp/$${TARGET}/bin 32 else: unix:!android: target.path = /opt/$${TARGET}/bin 33 !isEmpty(target.path): INSTALLS += target
main.h
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include "mainwindow.h" 2 3 #include <QApplication> 4 5 int main(int argc, char *argv[]) 6 { 7 QApplication a(argc, argv); 8 MainWindow w; 9 w.show(); 10 return a.exec(); 11 }
mainwindows.h
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QMainWindow> 5 6 #include <QWindow> 7 #include <QPushButton> 8 #include <QVBoxLayout> 9 10 QT_BEGIN_NAMESPACE 11 namespace Ui { class MainWindow; } 12 QT_END_NAMESPACE 13 14 class MainWindow : public QMainWindow 15 { 16 Q_OBJECT 17 18 public: 19 MainWindow(QWidget *parent = nullptr); 20 ~MainWindow(); 21 22 private: 23 Ui::MainWindow *ui; 24 25 QWidget *m_pWidget; 26 }; 27 #endif // MAINWINDOW_H
mainwindows.cpp
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include "mainwindow.h" 2 #include "ui_mainwindow.h" 3 4 #include <Windows.h> 5 6 MainWindow::MainWindow(QWidget *parent) 7 : QMainWindow(parent) 8 , ui(new Ui::MainWindow) 9 { 10 ui->setupUi(this); 11 12 LPCWSTR className = TEXT("Qt5QWindowIcon");// Qt5QWindowIcon // Notepad++ 13 HWND hwnd = FindWindow(className, NULL); 14 // WId wid = (WId)FindWindow(L"CalcFrame",NULL); 15 QWindow *calcWin = QWindow::fromWinId((WId)hwnd); 16 // calcWin->setFlags(m_window->flags() | Qt::CustomizeWindowHint | Qt::WindowTitleHint); 17 18 QWidget *owidget = new QWidget(this); 19 owidget->setGeometry(100, 100, this->width(), this->height()); 20 QWidget *calcWidget = QWidget::createWindowContainer(calcWin, owidget, Qt::FramelessWindowHint); 21 calcWidget->setMinimumSize(600,500); 22 } 23 24 MainWindow::~MainWindow() 25 { 26 delete ui; 27 }
相关文章
- QT-Qt设置背景图片
- Qt开源作品2-视频流播放vlc内核
- Qt编写地图综合应用53-省市轮廓图下载
- Qt最小化后恢复界面假死冻结
- Qt系列文章015-TCP客户端
- Qt中如何执行HTTPS请求
- Qt字符串
- Qt中实时更新UI程序示例
- Qt QSystemTrayIcon(托盘程序整个例子)
- Qt QWidget颜色设置的三种方法
- Qt 程序获取程序所在路径、用户目录路径、临时文件夹等特殊路径的方法
- Qt OpenGL 创建一个OpenGL窗口
- Qt 将界面程序封装成动态库DLL
- Qt 绘图之QGraphicsScene QGraphicsView QGraphicsItem详解
- Qt—动态库的创建和使用
- Qt函数体怎么使用
- Qt之实现工具箱界面程序
- Qt开发-QT Quick
- Qt GUI图形图像开发之QT表格控件QTableView详细使用方法与实例
- QT 程序打包的方法
- QT之UDP通信
- Qt学习: QListWidget程序示例
- Qt 关于窗口全屏显示与退出全屏的实现
- VS2019开发Qt程序中文乱码
- Qt easingCurve:QEasingCurve官方解析及实例
- 解决Ubuntu系统安装QT出错的问题:qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it
- QT 窗口关闭 程序进程不退出
- Qt 获取文件夹下所有文件
- Ubuntu下编译COM口相关程序,报错::-1: error: Unknown module(s) in QT: serialport
- QT 资源文件的添加
- Qt发布程序,发布可执行文件exe