DDXFile v1.1

For developers who use MFC this is a freeware DDX routine which subclasses an edit control to allow you to easily specify a file. When the edit control is correctly setup it will look like:

 

The button beside the edit control sports a tooltip when the button is over it and when the button is hit, the following dialog is displayed:

 

The caption of the dialog can be customized through the DDX routine. Another flag allows the developer to customize the dialog so that it uses the older style common dialog which looks like:

 

 

 

Features
History
Usage
API Reference
Contacting the Author

 

 

 

Features

 

 

 

Usage

To use ddxfile in your project simply include ddxfile.cpp and the 6 string resources from the test application in your application. Then #include ddxfile.h in which ever of your modules requires it and make the appropriate calls. Included is a simple dialog based application which shows how to use it. Basically all you need to do is add to your DoDataExchange function as follows:

void CTestgetfileDlg::DoDataExchange(CDataExchange* pDX)
{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CTestgetfileDlg)
  //}}AFX_DATA_MAP
  DDX_FilenameControl(pDX, IDC_FILE, m_ctrlGetFile, dwFlags, _T("Please specify a filename"));
}

 

 

 

History

v1.1 (17th September 1998)

 

 

 

API Reference

The following functions are provided:

DDX_FilenameControl
DDX_FilenameValue
DDV_FilenameControl

 

DDX_FilenameControl

void DDX_FilenameControl(CDataExchange* pDX, int nIDC, CGetFilenameControl& rCGetFilenameControl, DWORD dwFlags, const CString& sDialogTitle, const CString& sExtFilter);

Parameters

pDX is the usual CDataExchange object which will be passed into your DoDataExchange function.

nIDC is the dialog ID of the edit control to subclass.

rCGetFilenameControl will contain upon return the window control which manages the compound edit and button controls.

dwFlags is a combination of the bit values to customize the display of the dialog. See ddxfile.h for all the allowable values.

sDialogTitle is the caption to use for the filename picker dialog.

Remarks

Associates an existing edit control with dialog ID nIDC to a compound filename picker control. Normally you would calls to this function in your dialog class's DoDataExchange member function.

 

DDX_FilenameValue

void DDX_FilenameControl(CDataExchange* pDX, CGetFilenameControl& rCGetFilenameControl, CString& sFile);

Parameters

pDX is the usual CDataExchange object which will be passed into your DoDataExchange function.

rCGetFilenameControl is the folder control to get or set the filename for.

sFile is the actual file to get or set into the control depending on the direction of data exchange occuring .

 

DDV_FilenameControl

void DDV_FilenameControl(CDataExchange* pDX, CGetFilenameControl& rCGetFilenameControl, DWORD dwFlags);

Parameters

pDX is the usual CDataExchange object which will be passed into your DoDataExchange function.

rCGetFilenameControl is the filename control to get or set the filename for.

dwFlags is the flags to customize the bahaviour of the control.  The available flags are:

GF_OVERWRITEPROMPT   The user will be prompted about overwriting existing file prior to allowing selection
GF_FILEMUSTEXIST File must exist to be selected
GF_OLD_STYLE_DIALOG Use the old style file open dialog instead of the style as used in Windows Explorer


 

 

 

CONTACTING THE AUTHOR

PJ Naughter
Email: pjn@indigo.ie
Web: http://indigo.ie/~pjn
17th September 1998