博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Qt based Application Extension
阅读量:6793 次
发布时间:2019-06-26

本文共 3896 字,大约阅读时间需要 12 分钟。

  

Qt based Application Extension

This examples shows how to use the  and  classes to implement a Qt based user interface in a plugin DLL.

The plugin implements and exports a C function showDialog that can be called by any Windows application to display a modal Qt dialog. Before a Qt based user interface can be created a  object must exist, and the calling application's event loop and the Qt event loop must run together.

/**************************************************************************** ** ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of a Qt Solutions component. ** ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Solutions Commercial License Agreement provided ** with the Software or, alternatively, in accordance with the terms ** contained in a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file.  Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file.  Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** Please note Third Party Software included with Qt Solutions may impose ** additional restrictions and it is the user's responsibility to ensure ** that they have met the licensing requirements of the GPL, LGPL, or Qt ** Solutions Commercial license and the relevant license of the Third ** Party Software they are using. ** ** If you are unsure which license is appropriate for your use, please ** contact Nokia at qt-info@nokia.com. ** ****************************************************************************/ #include 
#include
#include
#include
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/ ) { static bool ownApplication = FALSE; if ( dwReason == DLL_PROCESS_ATTACH ) ownApplication = QMfcApp::pluginInstance( hInstance ); if ( dwReason == DLL_PROCESS_DETACH && ownApplication ) delete qApp; return TRUE; }

The DLL entry point function DllMain uses the QMfcApp::pluginInstance function to make sure that exactly one instance of exists in the process, and that the DLL owning that instance stays loaded in memory.

extern "C" __declspec(dllexport) bool showDialog( HWND parent ) {     QWinWidget win( parent );     win.showCentered();     QMessageBox::about( &win, "About QtMfc", "QtMfc Version 1.0\nCopyright (C) 2003" );     return TRUE; }

The C function showDialog is exported from the DLL and uses the  class to provide proper stacking and modality between the native Win32 window and the .

 http://doc.qt.digia.com/solutions/4/qtwinmigrate/winmigrate-qt-dll-example.html


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)
Qt Solutions

转载于:https://www.cnblogs.com/moher/archive/2013/03/18/2965309.html

你可能感兴趣的文章
php编译安装、加速及与nginx的整合
查看>>
Linux系统调优:提高磁盘吞吐量
查看>>
Hibernate5-一对多双向关联-左外连接-HQL
查看>>
项目管理001
查看>>
EBB-25、DNS3
查看>>
linux下安装ssh和利用ssh远程登录到另一台机器
查看>>
SecureCRT密钥远程ssh证书登录Linux
查看>>
句柄小悟
查看>>
Spring的理解
查看>>
我的友情链接
查看>>
iCloud1_Getting Started
查看>>
免费香港空间
查看>>
<ubuntu ping响应慢 延迟严重解决方案>
查看>>
mysql 安装
查看>>
java 消息摘要算法 SHA
查看>>
在ubuntu下配置C和C++的编译环境
查看>>
Linux系统开发 4 进程资源 环境 fork()子进程 wait() waitpid()僵尸 孤儿进程
查看>>
(转)delete和析构函数两者之间的联系
查看>>
常见DOS命令总结
查看>>
间隙锁例子
查看>>