我正在开发基于插件的应用程序,并且需要在发生事件时将数据(字符串,数组)发布回我的主EXE。我不太清楚如何去做,我已经考虑过在主应用程序中创建一个线程,这个线程会持续调用DLL中的一个方法来寻求数据,但是这似乎是非常低效的,有没有一些事件监听器使用这个?
I am developing a plug-in based application and need to be able to post data (strings, arrays) back to my main EXE when something happens. I'm not quite sure how to go about this, I have thought about creating a thread in the main application that would continuously call a method in the DLL asking for data but this seems very inefficient, is there some sort of event listener I could use for this?
谢谢。
推荐答案加载机制的插件DLL,您可以传入一个类对象/函数指针/委托/事件,DLL可以用来通知主应用程序插件生成的任何事件。
As part of the loading mechanism for the plug-in DLLs, you could pass in a class object / function pointer / delegate / event that the DLL can use to inform the main application of any events the plug-in generates.
更多推荐
将数据从dll发送回.exe
发布评论