Image Processing without using Temporary Files

From Visual Basic, I currrently call some routines in a C dll that does all of my image processing.  Currently, what I do is I use temporary files, to make this happen.  I pass the PictureBox's handle and the temporary file to the C routine.  The C routine, takes the handle, does some image processing to it, and then writes it out to the temporary file.  In visual basic, I then load the temporary file to the Picture box and then delete the temporary file.  I am wondering if its possible for me to do something similar to this without using a temporary file, as the performance might be better.

Below is a synopsis of what what I do:
In VB:

Dim tempRawFile As String
tempRawFile = GetTempFileName()
DLLFile.C_Routine Picture1.Handle, tempRawFile
Picture1 = LoadPicture(tempRawFile)
DeleteFile(tempRawFile)

In C this is what I do:
int CALLINGCONV C_Routine(HBITMAP fromHBMP,char *rawFileName) {

// I do something to fromHBMP then I write it out to rawFileName
// I then return OK
}

tedunniAsked:
Who is Participating?
 
PaulHewsConnect With a Mentor Commented:
Have you tried a Picture1.Refresh?  Might work best if AutoRedraw = True  That way the picture box will use the hidden memory bitmap to repaint the picture box.

Picture1.AutoRedraw = True
... set picture property
...
DLLFile.C_Routine Picture1.Handle
Picture1.Refresh  'force redraw based on memory bitmap

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.