C ++应用程序和C#应用程序之间的对象装箱和拆箱 [英] Object boxing and unboxing between C++ application and C# application

查看:80
本文介绍了C ++应用程序和C#应用程序之间的对象装箱和拆箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在开发一个必须在C ++和C#之间进行数据/对象(DTO)传输的项目。因为在我的项目中,图像处理是在C ++应用程序中完成的,图像显示是通过C#win-forms完成的。为了得到Image需要传递一个object类型的参数。

例如:

类RequestImageDTO 
{
int ImageID;
string ImageName;
}





所以为了获取Image Object需要设置ImageID和ImageName并使用该对象发送到C ++应用程序IPC(进程间通信)



假设在C ++应用程序中声明了相同类型的类,因此我们可以取消装箱对象并获取在C#侧设置的值C ++对象。

如果没有人可以建议如何达到我的要求。



预先谢谢。

解决方案

您最好在每种语言中使用本机对象并传输位图。根据操作,如果尺寸或深度发生变化,我会重新传输新的位图。



C ++:CBitmap Attach()和Deatch()



或写一个临时的bmp文件。 :-O

Hello everyone,

I am working on a project where data/Object(DTO) transfer has to be done between C++ and C#. since in my project Image processing is done in C++ application and Image display is done through C# win-forms. In order to get Image need to pass a parameter of type object.
Eg:

Class RequestImageDTO
{
    int ImageID;
    string ImageName;
}



so in order to get Image Object need to set the ImageID and ImageName and send that object to C++ application using IPC (inter-process communication )

Assume that the same type of class is declared at C++ application so can we unboxing the object and get the value set at C# side in C++ object .
If not can anybody suggest how to achieve my requirement.

Advance thanks.

解决方案

you better use native objects in every language and transfer a bitmap. And depending on the operation I would retransfer a new bitmap if dimension or depth are changed.

C++: CBitmap Attach() and Deatch()

or write a temporary bmp-file. :-O


这篇关于C ++应用程序和C#应用程序之间的对象装箱和拆箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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