Write an Array into a Picturebox control

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.

Jeremy

salsipiusAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nffvrxqgrcfqvvcCommented:
UINT32 WidthOut,  UINT32 HeightOut

WidthOut and HeightOut should be Long Values on VB
Mark_FreeSoftwareCommented:
you can try this:

set a dummy image in the picturebox that is the same size as the picture that you will use,
then save the mem address in a var:


dim i as long
i= ObjPtr(Picture1.Picture)

and then use copymemory to copy your array to that memory address


ps: i haven't tried this, just a suggestion what you could try ;)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MattFennerCommented:
you can probably use GDI+

you might need to do some research on how exactly to do it in your case
Mark_FreeSoftwareCommented:

i think a split is fair, because we all three provided some info and not a complete example
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.