Displaying a bmp file that is being changed

Jul 22, 2011 at 1:21am
Hello everyone!!

I hit a wall once again!. I have an application that performs some calculation and creates as a result a bmp file, then displays this result as a pop-up window (in a dialog box) that appears after pressing a button located in the main window.

Then, if I changed the parameters for the calculation the application creates a new bmp file; but If I press the button again the resultant image is always the first one to be loaded, i.e. the display does not updates itself even though the file has changed.

I did the implementation of the displaying of the image inside the WM_ERASEBKGND case of the dialog box procedure, using the LoadBitmap function. I do the cleaning and freeing of the Device context properly.

The question is, why is this happening? How can I make the reading and displaying of the image responding in real time to the changes in the bmp file?

Thanks a lot.
Jul 22, 2011 at 2:39am
LoadBitmap loads the bitmap from the executable itself, which cannot be changed at runtime.
You need LoadImage function.
Jul 25, 2011 at 12:13am
Thanks modoran.

It worked perfectly. I guess I will have to study the differences between using the two functions to load a bmp; but the important thing is that it works.

Jul 26, 2011 at 7:15am
I guess I will have to study the differences between using the two functions to load a bmp;


Not really. LoadBitmap is deprecated. You should always use LoadImage.

There's nothing you can do with LoadBitmap that can't be done with LoadImage.
Topic archived. No new replies allowed.