Selecting font files with CFileDialog

Hi,

I'm using VC++ 5.0 with Win95. I create a CFileDialog to select files. The CFileDialog does special
processing when the files displayed in the dialog are font files. In this case, the file name is not displayed, rather, the font name is displayed instead. When I select a font and click on the Open button, a font dialog pops up displaying a sample of the font.
I need to be able to select font files like any other file, without all this special extra processing
that the CFileDialog seems to be doing.

To see an example of what I am talking about, create a CFileDialog and select the
c:\windows\fonts directory on your system. Only the font names will be displayed, not the
font filenames. And selecting a font pops up a font dialog...

Thanks,
Ralph.
rakhrasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tommy HuiEngineerCommented:
At this point, why not make your own dialogs? It sounds like CFileDialog will only get in the way. You would probably be better off making your own dialogs. That way, you have complete control over what happens.

0
rakhrasAuthor Commented:
I want to avoid duplicating all the functionality that is already implemented in the CFileDialog. It seems like an overkill to reimplement CFileDialog just to handle font Files.
0
RONSLOWCommented:
I have tried this.  It doesn't happen unless I right click on the font and select 'open'.  Clicking on the open button does nothing (dialog stays up).  Guess it depends on the bits you select such as file must exist etc.

I suggest you turn off the explorer bit and therby use the old-style file open dialog.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kalaruCommented:
Did you try with the old style FileOpen dialog also (as suggested)?

If that doesn't work, then you may have to do your own dialog :-(

0
RONSLOWCommented:
thanks for your responses.

I have finally found a workaround to my problem that allows
me to display font files like any other file in a CFileDialog.

Here's a quick summary:

The Windows\Fonts folder behaves differently than other
folder because it is a so called "virtual name space".
Other folders like this one are the Recycle Bin, Temporary Internet files and so on.

You can make a folder a virtual name space by:

1. Making the folder read-only
2. Creating a Desktop.ini file in the folder

If you look (in a DOS box) at the Desktop.ini file in the
Windows\Font directory, you'll find that it defines a UICLSID.
I do not know the details as to how this IUCLSID modifies the
default behaviour of the CFileDialog.

The workaround consists in renaming the Desktop.ini
during the creation of the CFileDialog and restoring its
name when the CFileDialog is destroyed.
Note that there are some side effects to this workaround
since all applications will be temporarily affected.

Anyway, that's the summary.

I would like to close this question but there seems to be no way
to close it. So please do not answer this question anymore.

Thanks,
Ralph.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.