OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Using File Save common dialog boxes

The file save common dialog box serves as a single, consistent replacement for the many different types of dialog boxes that applications have previously used to let users choose file names.

TOpenSaveDialog::TData is used by both file open and file save common dialog boxes.

Example

In the following example, a file-save common dialog box prompts the user for a file name to save under. The default directory is \WINDOWS and the default extension is .BMP.

void TCanvasWindow::CmFileSaveAs()
{
TOpenSaveDialog::TData data
"Bitmap Files (*.BMP)|*.bmp|",
0, "\\windows", "BMP");
if (TFileSaveDialog(this, data).Execute() == IDOK) {
// save data to file ifstream
is(data.FileName);
if (!is)
MessageBox("Unable to open file", "File Error", MB_OK | MB_ICONEXCLAMATION);
else
// Do file output
}
}

See Also