Re: Cleaning Up Memory DC ?
I've never seen the source code to MS's device content manager so I can't
say exactly what happens. What I know is that the MS documentation says to
select each object out of the DC before deleting it, and you do that by
selecting in the original object. You are programming to MS software. Why
not just follow their recomendations?
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Robert A." <invalid@invalid.org> wrote in message
news:edBSSTHeGHA.1272@TK2MSFTNGP03.phx.gbl...
Hi,
Like this:
CBitmap* oldBitmap=memDC.SelectObject(&memBitmap);
// then when cleaning up
memDC.SelectObject(oldBitmap);
memDC.DeleteDC();
...is that really necessary ? What happens if I delete the memory DC with
the bitmap still in it ?
Thanks.
"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:ulJeQLHeGHA.1272@TK2MSFTNGP03.phx.gbl...
You need to select back the previous bitmap before deleting yours.
Note that CBitmap should delete itself when the function returns.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Robert A." <invalid@invalid.org> wrote in message
news:OzzJ6FHeGHA.3556@TK2MSFTNGP02.phx.gbl...
Hi guys,
Take a look:
CDC memDC;
CBitmap memBitmap;
memDC.CreateCompatibleDC(...);
memBitmap.CreateCompatibleBitmap(...);
memDC.SelectObject(&memBitmap);
// do my drawing and blit
// cleanup
memDC.DeleteDC();
...when I clean it up do I have to select the CBitmap out of the memory
DC, do I have to delete the CBitmap ? I thought I once read that if I
delete the memory DC with the bitmap in it everything will be fine. I've
never really been sure about this.
Thank you.
PS - I'm using VC6 (SP5) on XP Pro