BoundsChecker throws up a memory leak error in GDI when using the following code
HDC m_hrefdc, m_hmfdc;
HPALETTE hpal, psel;
m_hrefdc = CreateDC("DISPLAY", NULL, NULL, NULL);
m_hmfdc = CreateEnhMetaFile(m_hrefdc, NULL, &m_refrect, "Test Metafile");
hpal = CreatePalette( plogp );/** BOUNDSCHECKER ERROR **/
psel = SelectPalette( m_hmfdc, hpal, FALSE );
DeleteObject( psel );
RealizePalette( m_hmfdc );
( perform GDI commands on metafile )
m_mfhndl = CloseEnhMetaFile(m_hmfdc);
( Use metafile )
The problem is that when the metafile is created, m_hmfdc is
invalidated, so the new palette cannot be selected out of it to be deleted.
Does anyone know of a workaround for this, or is it a
BoundsChecker artifact ?