Coder's Guild Mailing List

Re: bitmap delete

Posted by Hal Bonnin on 2000-12-22

CBitMap *bmp;

bmp is a pointer. cant delete a pointer. a pointer goes out of scope and is
deleted.

DeleteObject(bmp); will delete the bitmap data stored at the location
pointed to by bmp.

if you want to see if the object is deleted check using

if(bmp!=NULL)
{
  DeleteObject(bmp);
}

if you ever use SelectObject  catch the return and delete it if you dont
want to use it anymore

i use

DeleteObject(SelectObject(bmp));

this changes the selection in the HDC and deletes the old object.

syntax in above not correct... im not using my complier right now :)