Code: Select all
if(hbmp_!=0)
{
CRect r;
CBitmap* m_bitmap=CBitmap::FromHandle(hbmp_);
CDC dc,*pDC=0;
pDC = this->GetDC();
dc.CreateCompatibleDC(pDC);
if(m_bitmap!=0 && dc.m_hDC!=NULL)
{
// Select the bitmap into the in-memory DC
CBitmap* pOldBitmap = dc.SelectObject(m_bitmap);
pDC->BitBlt(rect_->left,rect_->top,cx_,cy_,&dc, 0, 0, SRCCOPY);
pDC->SelectObject(pOldBitmap);
//::DeleteObject(dc);
m_bitmap->Detach();
m_bitmap->DeleteObject();
}
//dc.ReleaseOutputDC();
::ReleaseDC(this->m_hWnd,dc);
::DeleteObject(dc);
::DeleteObject(pDC);
}
else
{
CWnd::OnPaint();
}
Code: Select all
hbmp_ = (HBITMAP)dPlot_GetBitmapEx(DocNum, cxBitmap_, cyBitmap_, &dpm_);
any ideas?
P.S. The slow down comes when i switch a lot ,it might be a memory leak but i'm not creating anything else except what DPLOT gives me ,the HBITMAP.