The following series of commands are leaking a little GDI memory every time they are called. Something is not being deleted. Any ideas as to how to correctly delete the DC and bitmaps?
' Create hidden surface, m_ctrlhDC never changes through the
' life of the program
m_hDC = CreateCompatibleDC(m_ctrlhDC)
'To draw to the hidden surface need to create a bitmap
m_hBMP = CreateCompatibleBitmap(m_ctrlhDC, m_ctrlWidth, m_ctrlHeight)
'Attach Bitmap to hidden surface
m_OldhBMP = SelectObject(m_hDC, m_hBMP)
Local hBmp As Long
'First deselect bitmap
hBmp = SelectObject(m_hDC, m_OldhBMP)
Call DeleteDC(m_hDC)
Call DeleteObject(m_hBMP)
Call DeleteObject(hBmp)
' Create hidden surface, m_ctrlhDC never changes through the
' life of the program
m_hDC = CreateCompatibleDC(m_ctrlhDC)
'To draw to the hidden surface need to create a bitmap
m_hBMP = CreateCompatibleBitmap(m_ctrlhDC, m_ctrlWidth, m_ctrlHeight)
'Attach Bitmap to hidden surface
m_OldhBMP = SelectObject(m_hDC, m_hBMP)
Local hBmp As Long
'First deselect bitmap
hBmp = SelectObject(m_hDC, m_OldhBMP)
Call DeleteDC(m_hDC)
Call DeleteObject(m_hBMP)
Call DeleteObject(hBmp)
Comment