Original Post
🔒 Locked
quick MFC cleanup question
Advertisement
As soon as you Attach() the handle to the CBitmap, the CBitmap becomes responsable, the handle will be released in it''s destructor.
If you want to prevent the handle from being released when the CBitmap goes of scope, you have to Detach() it again. Then you''re responsable again.
btw: The entire MFC source comes with Visual Studio, you can do ''Edit/Find in files'', set the ''in folder'' box to something like ''c:\Program Files\MICROSOFT VISUAL STUDIO\VC98\MFC\SRC'' and enter a search term, for example ''~CBitmap'' and ''CGdiObject::DeleteObject''
If you want to prevent the handle from being released when the CBitmap goes of scope, you have to Detach() it again. Then you''re responsable again.
btw: The entire MFC source comes with Visual Studio, you can do ''Edit/Find in files'', set the ''in folder'' box to something like ''c:\Program Files\MICROSOFT VISUAL STUDIO\VC98\MFC\SRC'' and enter a search term, for example ''~CBitmap'' and ''CGdiObject::DeleteObject''
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement