What defines an old-style common dialog?
In the documentation for the
OPENFILENAME structure, there are many references to “old-style” dialogs. What is an old-style dialog, how do you get one, and how is it different from a new-style dialog?
So-called “old-style” dialogs are the File Open and File Save dialogs from Windows 3.1. Here’s roughly what they looked like:
These are not the “new” style dialogs that resemble an Explorer window. They are the old-fashioned dialogs that scream “I was written in the early 1990s!”
When you use an old-style dialog, Windows basically uses the code that was originally written for Windows 3.1, because programs from that era don’t support fancy things like long file names, and when they try to customize the dialog, they are expecting to customize a Windows 3.1-style dialog, so that’s what we give them.
Here are the main differences between the old style and new style dialogs:
|Long file names||No||Yes|
|Multiselect||Space-separated file names||Null-separated file names|
|Template||Replaces entire dialog||Embedded into existing dialog|
|Default extension||Maximum 3 characters||Can exceed 3 characters|
|Hooks||Windows 3.1-style||Windows 95-style|
The system decides whether you get an old-style or new-style dialog based on the following rules:
- If you say
OFN_EXPLORER, then you get a new-style dialog.
- If you don’t say
OFN_EXPLORER, and you do say
OFN_, then you get an old-style dialog.
- If you don’t say anything on the above list, then you get a new-style dialog.
In words: You get an old-style dialog if you ask for any of
OFN_, since those are the things that affect the programmatic behavior of the dialog. However, you can override this by saying
OFN_EXPLORER to say, “No really, I’m okay with the new hotness.”