Image Processing without using Temporary Files

Posted on 2005-04-18
Last Modified: 2010-05-02
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)

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

Question by:tedunni
    1 Comment
    LVL 38

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now