I am sending InvalidateRect from another function. What i want to do is this:
Erase the current window (imagine_aux), then send RestoreDc to get the initial image.
So after a HBITMAP was loaded, i save the dc, when it was moved, i simply want to delete everything and redraw the bitmap in the new position.
The bitmap loads, the image is moved, but the window isnt't reinitialised , so i get the trail.
Last edited by zorro59; June 21st, 2010 at 06:01 AM.
Just looking at your code, everything looks OK except the RestoreDC. That should only be called when a corresponding SaveDC has been called first, but both calls should be within the BeginPaint and EndPaint block. In your example above, neither one is really needed.
Get Pixel()? I'm not sure how that relates at all. I'm not sure, but I believe you want to sort-of cache a DC's contents (an already rendered screen) between paint cycles which is not what SaveDC() and RestoreDC() are for.
If you're trying to save a bitmap somehow, you'll need to go about that very differently.
Judging by the attempt to use SaveDC / RestoreDC, I guess saving to a file is not needed.
To cache content of your window, create compatible DC, select a properly sized bitmap into it and BitBlt the content of your DC into it.
When needed, you can BitBlt it back.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...