图片有指针这一说法没有?
我现在有一个dll,想调用它,是用来加载图片的,pfd的dll
从内存指针中加载
现在怎么获得图片的指针?
byte[] mydata = null;
if (dt.Rows.Count - 1 > = 0)
{
for (i = 0; i <= dt.Rows.Count - 1; i++)
{
mydata = (byte[])(dt.Rows[i].ItemArray[2]);
}
MemoryStream myStream = new MemoryStream();
foreach (byte a in mydata)
{
myStream.WriteByte(a);
}
myImage = System.Drawing.Image.FromStream(myStream);
// ApiLoad.UserPowerDll.FPDF_LoadMemDocument(System.Convert.myImage, myStream.Length, xx);
//System.Drawing.Image;
myStream.Close();
pic1.Image = myImage;
pic1.Refresh();
ApiLoad.UserPowerDll.FPDF_LoadMemDocument(System.Convert.myImage, myStream.Length, xx);
此句第一个参数为指针类型
------解决方案--------------------public unsafe static extern long FPDF_LoadMemDocument([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] data_buf, long size, [MarshalAs(UnmanagedType.LPStr)]string password);
试试这样写,给data_buf直接传递你那个mydata