Click here to Skip to main content
15,913,854 members

Comments by SonicMouse (Top 2 by date)

SonicMouse 16-Nov-13 2:47am View    
Windows may babysit with GDI objects in MFC... I don't know. But MS still says (to this day) in the docs:

SelectObject():
This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object.
SonicMouse 13-Nov-13 15:48pm View    
there are GDI memory leaks in this.

dcMem.SelectObject(bmp);
dcMem.SelectObject(GetFont());

You never select the old objects back in to the DC -- so the original DC can never delete them.

You do it correctly with the CPen object, though.

Oh, and CreateDiscardableBitmap() is depreciated.