Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CFileDialog creates GDI objects and doesn't clean them up.

0 views
Skip to first unread message

JamesW Via Google

unread,
Apr 15, 2005, 9:43:16 AM4/15/05
to
I've created a simple MFC dialog app <http://weatherley.net/noddy.zip>
which has a button that raises a common file dialog. The only code
change I've made from the devstudio generated boilerplate is:

void CNoddyDlg::OnButton1()
{
// TODO: Add your control notification handler code here
FileDialog dialog(TRUE);
dialog.DoModal();
}


Before raising the dialog the state of play with regards to GDI
Objects is:

DC 5
Brush 1
Bitmap 1
Font 1
--------
Total 8

Pushing the button and raising the file dialog:

DC 19
Brush 13
Bitmap 16
Font 16
Palette 2
Region 1
---------
Total 67

Closing the file dialog:

DC 15
Brush 11
Bitmap 11
Font 1
Region 1
----------
Total 39

Coming out of WinMain()

DC 15
Bitmap 11
Brush 11
Region 1
----------
Total 38


The extra bitmaps appear to be image lists and masks of folders and
the like - see <http://weatherley.net/pics/imagelist.jpg> for an
example. The questions are:

o Why doesn't the CFileDialog clean up after itself?
o Is it something I've forgotten to do or is this behaviour 'by
design'?
o Is there any way of dumping the CFileDialog related GDI objects?

Cheers

David Lowndes

unread,
Apr 16, 2005, 6:20:13 AM4/16/05
to
>o Why doesn't the CFileDialog clean up after itself?

It may be caching them so that next time it's used it's faster?

>o Is it something I've forgotten to do or is this behaviour 'by
>design'?

I'd assume it's by design.

>o Is there any way of dumping the CFileDialog related GDI objects?

None that I know of.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

0 new messages