I would like to be able to dynamically load and display images in a Windows application written in an old version of MS Visual C++.

I'm currently using functions as given here by Karl Lilje.

The pictures display fine when they are supposed to but they are not "persistent" (by which I mean that if you shift focus away from the application by putting another window on top of it and then going back, minimizing the application and then bringing it back, or maximizing the window - the picture disappears).

What are some other ways of displaying these images that might solve that problem? The image that is displayed is based on an event in the code and should stay up until that event happens again (and the picture should change). I don't keep track of which image should currently be displayed although I probably could if there is a way to re-render the image when the focus is brought back to the application dialog.

What version of VC++ are you using? I hope its not 1.52C :twisted:

MS-Windows sends out a WM_PAINT message when one of the events you mehtioned happens. Here are a few suggestions how to do it. Capture the WM_PAINT event or implement OnPaint() method, which one to use depends on how you write the program.