ID Number: Q74612
3.10
WINDOWS
Summary:
Applications can now call the common dialog dynamic-link library (DLL)
to retrieve the name of a file that the user wants to manipulate.
Using this DLL provides a common interface for opening files across
applications and also eliminates dialog-box message processing within
the application's code. However, the application must initialize a
structure specific to the dialog box. This article discusses the
benefits and costs of using the Open File common dialog.
More Information:
When an application uses the Open File dialog box provided by the
common dialog DLL, the primary benefit to that application's users
will be a familiar interface. Once they learn how to open a file in
one application that uses the DLL, they will know how to open a file
in all applications that use it.
For the application's programming staff, the benefits of using the
Open File common dialog will include:
- No dialog-box message processing necessary to implement the Open
File dialog box
- Drive and directory listings are constructed by the DLL, not by
the application
- A full pathname for the file to be opened is passed back to the
application, and this name can be passed directly to the OpenFile
function
- Offsets into the full pathname are also returned, giving the
application access to the filename (sans pathname) and the file
extension without the need for parsing
- The application can pass in its own dialog box template, in which
case the DLL will use that template instead of the standard template
- The application can provide a dialog hook function to extend the
interface of the DLL or to change how events are handled
- The application can choose to have a single filename or multiple
filenames returned from the dialog box
The cost for the programming staff could be in adapting previously
written application code to handle the common dialog interface. While
making this change is straightforward, it does require coding time. If
the application only needs a filename with no path, the Open File
common dialog is probably not appropriate.
For more information on using the Open File common dialog, query on
the following words:
OPEN and FILE and DIALOG