Solved

Selecting font files with CFileDialog

Posted on 1997-12-03
5
904 Views
Last Modified: 2013-12-03
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.
0
Comment
Question by:rakhras
5 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1311448
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
 

Author Comment

by:rakhras
ID: 1311449
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
 
LVL 10

Accepted Solution

by:
RONSLOW earned 200 total points
ID: 1311450
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
 

Expert Comment

by:kalaru
ID: 1311451
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
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1311452
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now