I have a problem with bitmaps cutting off after being displayed. When another window moves over my program's window the bitmap is erased and the back of the window is visible.
Each time the window needs redrawing, the WM_PAINT message is sent to it. So you need to handle it and restore your current window state.
And this must bring in absolutely different logic. You must always modify a bitmap in memory dc but never in window dc directly. The window dc is updated from your memory dc on WM_PAINT.
So you're saying that I need to load the bitmaps into memory dc and WM_PAINT whenever the screen regains focus? I think I follow you, but I don't know much about using the tools of the trade. Is there any sample code out there that shows how to load a bitmap into a memory DC? I've done console programming for years but have only been using WinAPI for a few months. So much more complicated than simple cin/cout stuff.
Is what I'm doing is loading the bitmap directly into the window dc?
So you're saying that I need to load the bitmaps into memory dc and WM_PAINT whenever the screen regains focus?
Well, not exactly. What I'm saying is: the logic of manipulations with the bitmaps should be adapted to the new requirement of being able always to restore window areas, and using memory dc is the technique you should learn an use.
I think I follow you, but I don't know much about using the tools of the trade. Is there any sample code out there that shows how to load a bitmap into a memory DC?
Sure, see the attachment. The sample gives you a main idea: the image is stored all the time in the bitmap object (g_hbm) and painted to a window whenever it is needed involving memory dc.
Another idea related to the one above: to change the window image you apply the changes to the bitmap object (again by means of memory dc), but painting procedure remains intact.
I've done console programming for years but have only been using WinAPI for a few months. So much more complicated than simple cin/cout stuff.
Basicly, yes. For the first glance.
Is what I'm doing is loading the bitmap directly into the window dc?
Exactly. When you GetDC, make operations against it and ReleaseDC you operate directly with window dc.
Do you have Windows Platform SDK? Its Samples folder contains various sample programs you could read and dissect. But before doing this, you definitely need to read Charles Petzold's Programming Windows to catch the very basic principles of Windows.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.