hello thx for the help!
Finally I chosse to use a buffer as you said.
But now I got sometime this exception :
Unhandled exception at 0x0004bf14 in BITMAPLOADER.exe: 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x00000004 :
Code:
BOOL CGdiObject::DeleteObject()
{
if (m_hObject == NULL) <========= HERE
return FALSE;
return ::DeleteObject(Detach());
}
Do you know where does it come from ?
My blitter function :
Code:
void Blitter::BlitTo (CDC& pDC){
//
CDC dcMemory;
//
CBitmap *spBitMap= CBitmap::FromHandle(_bmp->_hBitmap);
// create a new dc :
dcMemory.CreateCompatibleDC(&pDC);
// add the bitmap :
dcMemory.SelectObject(spBitMap);
//
// update the screen with this :
pDC.BitBlt(_xDst, _yDst, _width-_xSrc, _height-_ySrc,&dcMemory,_xSrc, _ySrc, _mode);
spBitMap->DeleteObject();
dcMemory.DeleteDC();
//delete spBitMap;
}
The creation of my buffer :
Code:
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct) {
CDC *dc = GetDC(); // this is the screen DC
m_MemDC.CreateCompatibleDC(dc);
m_Bitmap.CreateCompatibleBitmap(dc,WINDOW_W,WINDOW_H);
m_MemDC.SelectObject(m_Bitmap);
ReleaseDC(dc);
return 0;
}
my paint function called with RedrawWindow() :
Code:
void CChildView::OnPaint() {
CPaintDC dc(this);
dc.BitBlt(0,0,WINDOW_W,WINDOW_H,&m_MemDC,0,0,SRCCOPY);
DeleteDC(dc);
}