简体   繁体   English

图像回调C ++到C#

[英]Image callback c++ to c#

I have the following problem: I have a method in a c++ dll that uses some code from a hardware developer that captures an image in a "BITMAPINFO * info;" 我有以下问题:我在c ++ dll中有一个方法,该方法使用来自硬件开发人员的一些代码来捕获“ BITMAPINFO * info;”中的图像。

http://msdn.microsoft.com/en-us/library/windows/desktop/dd183375%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/dd183375%28v=vs.85%29.aspx

know I have to send it to ac# class that uses it, so I must send a callback to the c# class, right know I solve the problem sending the image to a file and reading the file form the C# class but I know it is not the correct form to do it. 知道我必须将其发送到使用它的ac#类,因此我必须将回调发送到c#类,知道我解决了将图像发送到文件并从C#类读取文件的问题,但是我知道格式不正确。

If someone knows how I can convert the bitmapinfo * to a byte * or how to implement the callback for a bitmapinfo to a managed code in c# it would be great. 如果有人知道如何将bitmapinfo *转换为字节*或如何在c#中将bitmapinfo的回调实现为托管代码,那就太好了。

Tanks for the time and sorry for my English ;) 浪费时间,对不起我的英语;)

the solution was using Pinvoke.net, its possible to use native c++ code for the marshal in c#. 解决方案是使用Pinvoke.net,可以在c#中使用本机c ++代码进行编组。 for get more information you can go to: http://msdn.microsoft.com/en-us/library/at4fb09f(v=vs.100).aspx http://pinvoke.net/default.aspx/Structures.BITMAPINFO 有关更多信息,请访问: http : //msdn.microsoft.com/zh-cn/library/at4fb09f( v=vs.100) .aspx http://pinvoke.net/default.aspx/Structures.BITMAPINFO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM