I need to write an array of integers into a picturebox control on my VB form. I have a DLL that grabs an image from a framegrabber, if anyone is familiar with it it is the Coreco X64 CL.
So far what I am doing is in VB I create an Integer Array, you may ask why an Int array and not Byte? I asked the same question to my supervisor and he said because in VB and Integer is 2 Bytes and in c we are using a WORD for the elements of the image array and a WORD is 2Bytes in C, is this making sense?
iImageArray(0 to (cameraWidth * cameraHeight)) As integer '1024 *1024
I then call my DLL function WP13GetImage sending a pointer to my array
WP13GetImage(iImageArray(0), height, width)
In my DLL id do something like this
int _stdcall WP13SaperaGetImage(WORD * pImageOut, UINT32 WidthOut, UINT32 HeightOut)
WORD * pLocalImageBuffer;
//I get the address of the framegrabber buffer using a Handle to the framegrabber and copy it to my local Buffer pointer address
CorBufferGetPrm(hFrameGrabberBuffer, CORBUFFER_PRM_ADDRESS, &pLocalImageBuffer);
//Now I copy the memory space to the Pointer for my ImageArray from VB
memcpy(pImageOut, pLocalImageBuffer, WidthOut*HeightOut*sizeof(WORD));
So far I think this is working OK, please let me know if you see anything suspect so I can try to fix it.
Now back to my VB form, So I shoud have an integer Array that is full of data now I can't seem to understand how to get this data into a picturebox so I can display it.
Just a note, I don't want to write it to a file as this would slow things down more than I can afford.
Can anyone hlep please, I have been bashing away at this for to long now and it is starting to really bug me.