Retrieve data from unmanaged code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gudguy
    New Member
    • Sep 2007
    • 15

    Retrieve data from unmanaged code

    Im using an OCX in my C# application. It's triggering an event of this signature:

    private void GetData(int size, byte pData)

    the orignal signature in c++ before it was compiled:

    HRESULT GetData(int size, BYTE* pData);

    The documentation says that the pData is a pointer to allocated memory holding the data packet (most probably a bitmap object in my case).

    I have tried this to get the data:
    byte[] bytes = new byte[size];
    Marshal.Copy(ne w IntPtr((int)e.p Data), bytes, 0, size); // AccessViolation exception (Attempted to read or write...)

    Anyone with better idea?

    Thanks in advance.

    regards,
    gudguy
Working...