将数据从dll发送回.exe [英] Send data back to .exe from dll

查看:139
本文介绍了将数据从dll发送回.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于插件的应用程序,并且需要在发生事件时将数据(字符串,数组)发布回我的主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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆