如何从java加载和调用MFC DLL? [英] How to load and call a MFC DLL from java?

查看:406
本文介绍了如何从java加载和调用MFC DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从Java调用MFC dll。因此感觉好像Java推出了MFC用户界面。



我正在使用带有C ++的IMAPI 2.0开发一个MFC dll来刻录DVD / CD上的数据。我想从Java&中调用这个dll。因此运行MFC dll及其UI。这将有助于监控刻录过程。



我尝试过:



我尝试使用JNI从Java加载常规dll。但是如果我们可以从dll继续更新执行进度到Java,需要帮助。

How to call a MFC dll from Java. So that it feels as if Java launched the MFC UI.

I am developing a MFC dll using IMAPI 2.0 with C++ to burn data on DVD/CD. I want to call this dll from Java & hence the run MFC dll with its UI. This will help in monitoring the burn process.

What I have tried:

I tried loading regular dll from Java using JNI. But need help if we can continuously update the progress of execution to Java from dll.

推荐答案

你必须在第一次使用之前正确初始化MFC运行时,就像它< a href =https://msdn.microsoft.com/en-us/library/aa279252(v=vs.60).aspx>这里描述。



为了更新UI,您必须使用JNI为MFC-dll实现一个接口函数,其中更新(作为消息参数)发出信号。



因为JRE / JNI和MFC在不同的线程中,所以你需要在dll中正确处理。文章 PostThreadMessage Demystified 可以指导您正确的方向。
You must correct initialize the MFC runtime before the first use, like it is here described.

For updating the UI you must implement an interface function with JNI to the MFC-dll, in which the update (as message parameter) the signaled.

Because the JRE/JNI and the MFC are in different threads you need proper handling in the dll. The article PostThreadMessage Demystified may guide you in the right direction.


请参阅 jni mfc - Google搜索 [ ^ ]。



另外,您已经在如何使用IMAPI 2.0监控刻录进度并将更新传递给java [ ^ ]。请不要重新发布。
See jni mfc - Google Search[^].

Also, you already posted this question at How to monitor progress of burn using IMAPI 2.0 and pass updates to java[^]. Please do not repost.


这篇关于如何从java加载和调用MFC DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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