简体   繁体   English

MFC DLL的GUI工具?

[英]GUI harness for MFC DLL?

I have a CWinApp-based application that is built as a DLL that is loaded by another 3rd party application as a plugin. 我有一个基于CWinApp的应用程序,该应用程序被构建为DLL,并由另一个第三方应用程序作为插件加载。 My app exposes an exported StartPlugin() method that creates a CDialog derived dialog. 我的应用程序公开了导出的StartPlugin()方法,该方法创建了CDialog派生的对话框。 This exported function is somehow called by the 3rd party application. 此导出的函数以某种方式被第三方应用程序调用。 I'd like to be able to run my DLL outside of the 3rd party application so I can test and play around with UI stuff (not for unit testing). 我希望能够在第3方应用程序之外运行DLL,以便我可以测试和试用UI内容(不适用于单元测试)。

How can I create a test harness that will allow me to run my dll code? 如何创建测试工具,使我可以运行dll代码? I'm not sure how the main application launches my dll plugin, but I'm speculating that it's creating a User-Interface thread? 我不确定主应用程序如何启动我的dll插件,但是我推测它正在创建用户界面线程? So would I just need to create a simple exe that can somehow load my dll and create a new thread or something. 因此,我只需要创建一个可以以某种方式加载我的dll并创建新线程或其他内容的简单exe。 Any links to tutorials or articles that explain something like this. 指向解释此类内容的教程或文章的任何链接。

Use the Visual Studio wizard to create a MFC application, probably Dialog based. 使用Visual Studio向导创建MFC应用程序(可能基于对话框)。 Have a button on the dialog to run your plugin. 在对话框上有一个按钮来运行您的插件。 In the button code do a LoadLibrary with the name of your DLL, then call GetProcAddress to get a pointer to the StartPlugin function. 在按钮代码中,使用您的DLL名称执行LoadLibrary,然后调用GetProcAddress以获取指向StartPlugin函数的指针。 Then you can call StartPlugin. 然后,您可以调用StartPlugin。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM