my buffer won't copy
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
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]
signed,
[edited by - Enselic on December 12, 2002 5:52:37 AM]
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]
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?
once you get to a failing function, use GetLastError() to get extended error information. what does it return?
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]
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
Popular Topics
Advertisement