API interfacing with a LPBYTE from C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave A

    #1

    API interfacing with a LPBYTE from C#

    Hi, I have the following function that I need to call from C#.

    HRESULT CamPreviewGetBG R16(HANDLE hCamera,LPBYTE pBuffer);

    but I am stuggling with the LPBYTE pBuffer. I have decalred it as

    [DllImport("mobi lecamapi.dll",E ntryPoint="CamP reviewGetBGR16" )]
    public static extern int CamPreviewGetBG R16(uint hCamera, byte[] pBuffer);

    and have called it via:

    byte[] buffer = new byte[width * height * 2];
    result = CamPreviewGetBG R16(cameraHandl e, buffer);

    It is returning with a missing method exception. I think the 'byte[]
    pBuffer' in the API definition needs to be a 'uint pBuffer' but then how do
    I convert the 'byte[] buffer' in the calling code to be a uint? (I am a bit
    of a novice at all of this Interop stuff)

    Any suggestions are greatly appreaciated.

    Thanks

    Dave A



Working...