Qt:如何创建Windows DLL(导出函数)?

发布于 2024-10-18 16:21:46 字数 1429 浏览 2 评论 0原文

我需要创建一个导出函数并具有图形用户界面的 Windows DLL。 GUI 位于 DLL 中的原因是 DLL 充当其他第 3 方应用程序的一种插件。目前我只能访问 Visual Studio Express,据我所知它不支持 MFC,所以我正在寻找在 DLL 中创建 GUI 的替代方法。经过一番研究后,我发现了 Qt,它看起来很有前途。看起来使用 Qt Creator IDE 可能比使用 Visual Studio Express 更容易。

但是,如何在 Qt Creator 中创建 Windows DLL? (我猜是常规 DLL,我不认为 COM 或托管 DLL 可以工作)

更新: 我成功了!经过几道坎之后,添加了两个重要的关键

 #include <windows.h>

,然后使用 Qt/MFC 迁移框架工具(目前官方提供:http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtwinmigrate 编辑:我相信这是新链接: https://github.com/qtproject /qt-solutions/tree/master/qtwinmigrate

我用这个例子来让我继续:

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

编辑:我相信这是新链接 http://htmlpreview.github.io/?https://github.com/qtproject/qt-solutions/blob/master/qtwinmigrate/doc /html/winmigrate-qt-dll-example.html

I need to create a windows DLL that exports functions and has a graphical user interface. The reason for the GUI in the DLL is that the DLL serves as a kind of plugin for another 3rd party application. Currently I only have access to Visual Studio Express which AFAIK doesn't support MFC so I'm looking for alternative ways to create a GUI in a DLL. After some research I came across Qt which seems promising. And it seems like it might be easier to just use the Qt Creator IDE rather than Visual Studio Express.

However, how do I create a windows DLL in Qt Creator? (I guess a regular DLL, I don't think a COM or managed DLL will work)

UPDATE:
I got this working! After jumping through several hoops, two important keys were to add

 #include <windows.h>

And then to use the Qt/MFC Migration Framework tool (currently officially available at: http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtwinmigrate EDIT: I believe this is the new link: https://github.com/qtproject/qt-solutions/tree/master/qtwinmigrate)

I used this example to get me going:

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

EDIT: I believe this is the new link http://htmlpreview.github.io/?https://github.com/qtproject/qt-solutions/blob/master/qtwinmigrate/doc/html/winmigrate-qt-dll-example.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

溺ぐ爱和你が 2024-10-25 16:21:46

将以下行添加到 .pro 文件中: TEMPLATE = lib

这就是让 QtCreator 将您的“应用程序”制作成 dll 所需要做的全部工作。

Add the folowing line to the .pro file: TEMPLATE = lib

That's just about all you'll have to do to have QtCreator make your 'app' into a dll.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文