[DllImport("kernel32.dll",EntryPoint="CopyMemory" ,SetLastError=true)]
      internal static extern void CopyMemory(int Destination,byte Source,long Length);  以上为API声明下面为调用,但出错,错在哪里呢?
         byte[] pbyteImageBuffer;
        int lAddrImage;        dwBufferSize = dwWidth * dwHeight;
        pbyteImageBuffer=new byte[dwBufferSize];  
 
        axFvxImage1.GetImageAdrs(out lAddrImage, 0);
        CopyMemory(lAddrImage, pbyteImageBuffer[0], dwBufferSize);

解决方案 »

  1.   

    参考:
    http://blog.csdn.net/Python/archive/2007/08/24/1757002.aspx
      

  2.   

    [DllImport("kernel32.dll",EntryPoint="CopyMemory" ,SetLastError=true)] 
    internal static extern void CopyMemory(IntPtr Destination,IntPtr Source, uint Length);  ???
      

  3.   

    try 
    System.Runtime.InteropServices.Marshal.Copy()Copies data from a managed array to an unmanaged memory pointer, or from an unmanaged memory pointer to a managed array. 
      

  4.   

    .NET已经封装了内存拷贝方法,搂主可以直接调用的:Marshal.Copy
      

  5.   

    谢谢net5i,我用Mershal.Copy OK了,但我担心用这个会不会有问题,因为网上说这个不太好用。            Marshal.Copy(pbyteImageBuffer,0,(IntPtr)lAddrImage,(int)dwBufferSize);