我可以在非CWinApp DLL中创建CWinApp样式的应用程序对象吗? [英] Can I make a CWinApp-style application object in non-CWinApp DLL?
本文介绍了我可以在非CWinApp DLL中创建CWinApp样式的应用程序对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MFC EXE或DLL中,你(可以)有一个 extern
-alised theApp
全局对象来访问成员您的应用程序类。
我正在通过他们的SDK为第三方软件开发一个加载项DLL。我必须使用的App类不是从CWinApp派生的。如何创建一个指向App类(单实例)的简单全局指针?
In an MFC EXE or DLL you (can) have an extern
-alised theApp
global object to access members of your application class.
I'm developing an add-in DLL for third-party software, via their SDK. The App class I must use is not derived from CWinApp. How can I create a simpilar global pointer to the (single-instance) of the App class?
推荐答案
是。你可以使用全局对象或指针。
这些任务通常用句柄解决,实际上是一个指向有效对象的指针。在这种情况下,您可以从dll中导出至少3个函数,如:此蓝图:
HANDLE Create(); // get object
void Destroy(HANDLE h); //自由对象
int DoSomeStuff(HANDLE h,int stuff); //做工作
Yes. You can use an global object or pointer for it.
These tasks are often solved with a handle, which in reality is a pointer to a valid object. In that case you export at least 3 functions from the dll like this blueprint:
HANDLE Create();//get object
void Destroy(HANDLE h);//free object
int DoSomeStuff( HANDLE h, int stuff);//do work
这篇关于我可以在非CWinApp DLL中创建CWinApp样式的应用程序对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文