my buffer won't copy

Started by
10 comments, last by egwenejs 21 years, 4 months ago
I''m trying to recreate a simple double buffer for a small app and for some reason I can''t get the buffer DC to copy to the screen DC. Here''s the basic idea of the code. CDC dcMem; CDC dcBitmap; CBitmap bmCurrent; CBitmap* pbmOld; bmCurrent.LoadBitmap(IDB_ENERGY); dcMem.CreateCompatibleDC(pDC); dcBitmap.CreateCompatibleDC(&dcMem); pbmOld = dcBitmap.SelectObject(&bmCurrent); dcMem.BitBlt(0,0,640,480,&dcBitmap,0,0,SRCCOPY); dcBitmap.SelectObject(pbmOld); then later pDC->BitBlt(0,0,640,480,&dcMem,0,0,SRCCOPY); Any help would be appreciated. Thanks egwenejs - that one guy
Advertisement
you may call me lame, but I say skip the MFC shit and learn win32 API instead...

signed,


[edited by - Enselic on December 12, 2002 5:52:37 AM]
[s]--------------------------------------------------------[/s]chromecode.com - software with source code
True as that may be what happens if that IS NOT an option.

Thanks

egwenejs - that one guy
Where is pDC declared? Are you sure it is valid?
Yes pDC is past to me from CView::OnDraw(CDC* pDC)

egwenejs - that one guy

[edited by - egwenejs on December 13, 2002 3:02:32 AM]
all GDI functions return values indicating whether the respective operation succeeded or failed. which, if any, function in your code fails?

once you get to a failing function, use GetLastError() to get extended error information. what does it return?
All functions return TRUE and GetLastError returns 0 at the end

egwenejs - that one guy
did you select a bitmap into dcMem?
I fiddled around with creating a compatible bitmap to dcMem and selecting that, but it just fills the screen with blackness. How would I get this bitmap to represent what is in dcBitmap without loading the orginal bitmap (bmCurrent) directly into it??

Thanks

egwenejs - that one guy

[edited by - egwenejs on December 13, 2002 3:56:34 AM]
try creating a bitmap compatible with your window dc with dimensions equal to client area of your window, and selecting that into dcMem.

This topic is closed to new replies.

Advertisement