The program has no tip errors ,But there is no any picture display in c++ form,Tested the simple data types, such as int, can be normal delivery,please give me a simple example ,tell me what to do
--------------------------------------------------------------------------
C# Code
[DllImport("dllTestForm.dll", EntryPoint = "showFormC")]
static extern void testShowFormC(byte[] photo,int len);
private void button6_Click(object sender, EventArgs e)
{
Bitmap bmp = (Bitmap)Image.FromFile(@"d:\1\1.jpg");
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,bmp.PixelFormat);
IntPtr ptr = bmpData.Scan0;
int bytes = Math.Abs(bmpData.Stride) * bmp.Height;
byte[] rgbValues = new byte[bytes];
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
bmp.UnlockBits(bmpData);
testShowFormC(rgbValues, bytes);
}
--------------------------------------------------------------------------
C++ Code
[DllImport("dllTestForm.dll", EntryPoint = "showFormC")]
static extern void testShowFormC(byte[] photo,int len);
void __stdcall showFormC(byte *photo,int len)
{
ThelloWorld *a=new ThelloWorld(Application); a->ImageEnView2->IO->LoadFromBuffer(photo,0,len);
a->Show();
}