Solved

Selecting font files with CFileDialog

Posted on 1997-12-03
5
931 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…

626 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