The FileSaveAsDlg component is used by several Application Integration command components, such as Download and Upload, to prompt the user for a filename and destination directory through the use of a modal File Save As dialog. The client application uses the IFileSaveAsDlg interface to control the dialog behavior and to specify initial values for the various dialog input fields. After the dialog has been invoked by calling IFileSaveAsDlg::DoModal, the IDlgResults interface is used to retrieve the values entered by the user.
coclass FileSaveAsDlg {
[default] interface IFileSaveAsDlg;
};
DLL | FnAppIntOpenSaveDlg.dll |
See Also | IDlgResults Interface, Upload and Download commands |
The IFileSaveAsDlg interface defines the following methods:
Method | Description |
---|---|
DoModal | Invokes the FileSaveAsDlg component, which causes the File Save As dialog to be displayed to the user. |
Initialize | Initializes the FileSaveAsDlg component by specifying initial values for the dialog input fields, including the dialog title, and identifying flags to control the dialog behavior. |
The following is a fragment from the complete example for the Upload command, which utilizes a FileSaveAsDlg component.
...
// Instantiate the FileSaveAsDlg component to prompt
// the user for a file and destination directory
IFileSaveAsDlgPtr spiFileSaveAsDlg;
hResult = spIFileSaveAsDlg.CreateInstance(__uuidof(FileSaveAsDlg));
if (FAILED(hResult)) {
std::cout << "Could not create the FileSaveAsDlg component.\n";
_ASSERTE(0);
}
// Specify the initial values for the dialog input fields
_bstr_t bstrTitle = (_T("Save the Downloaded File As..."));
_bstr_t bstrFileName = (_T("filename"));
_bstr_t bstrDirectoryName = (_T("C:\Downloaded Documents\"));
_bstr_t bstrFilterList(_T( "Device Independent Bitmap (*.bmp)|*.bmp|
GIF Graphics Interchange Format (*.gif)|*.gif|
JPEG File Interchange Format (*.jpg)|*.jpg|
Microsoft PowerPoint (*.ppt)|*.ppt|
Microsoft Word (*.doc)|*.doc|
Outline/RTF (*.rtf)|*.rtf|
Web Page (*.htm;*.html)|*.htm;*.html"));
long lFilterIndex = 0L;
// * Specify the optional control flags here
VARIANT vFlags = "";
// Initialize the FileSaveAsDlg component
std::cout << "Initializing the FileSaveAsDlg component..." << std::endl;
spIFileSaveAsDlg->Initialize(bstrTitle, bstrFileName, bstrDirectoryName, bstrFilterList, lFilterIndex, vFlags);
// Invoke the FileSaveAsDlg component to display the File Save As dialog
std::cout << "Attempting to display the File Save As dialog..." << std::endl;
hResult = spIFileSaveAsDlg->DoModal();
if (FAILED(hResult)) {
std::cout << "Could not create the File Save As dialog.\n";
_ASSERTE(0);
} else {
// Retrieve the filename and type entered by the user
IDlgResultsPtr spIDlgResults(spIFileSaveAsDlg);
std::cout << "FileName=" << (LPCSTR) spIDlgResults->GetFileName() << std::endl;
std::cout << "DirectoryName=" << (LPCSTR) spIDlgResults->GetDirectoryName() << std::endl;
std::cout << "FullPathName=" << (LPCSTR) spIDlgResults->GetFullPathName() << std::endl;
std::cout << "FilterIndex=" << spIDlgResults->GetFilterIndex() << std::endl;
std::cout << "ErrorCode=" << spIDlgResults->GetErrorCode() << std::endl;
std::cout << "ErrorMessage=" << (LPCSTR) spIDlgResults->GetErrorMessage() << std::endl;
std::cout << "Flags=" << spIDlgResults->GetFlags() << std::endl;
}
...