IFileSaveAsDlg::Initialize

The Initialize method initializes the FileSaveAsDlg component by specifying the initial values for the fields on the File Save As dialog, including the dialog title, filename and destination directory, file type filter list, and optional flags to control the dialog behavior.

void spIFileSaveAsDlg->Initialize(_bstr_t bstrTitle,
                                  _bstr_t bstrFileName,
                                  _bstr_t bstrDirectoryName,
                                  _bstr_t bstrFilterList,
                                  long lFilterIndex,
                                  VARIANT vFlags);
Parameters
bstrTitle - [in] Required _bstr_t, which specifies the title for the dialog.
bstrFileName - [in] Required _bstr_t, which specifies the filename to initially display in the dialog.
bstrDirectoryName - [in] Required _bstr_t, which specifies the destination directory to initially display in the dialog.
bstrFilterList - [in] Required _bstr_t, which specifies the list of file types (a list of strings delimited with the semi-colon).
lFilterIndex - [in] Required Long, that specifies which type in the filter list to initially show as selected in the dialog.
vFlags - [in] Optional VARIANT, which specifies one or more control flags to alter the behavior of the dialog. For more information about how to use these control flags, see the Win32 SDK documentation on the Microsoft Web site.
Results
This method always returns an HRESULT value of S_OK if successful.
Sample
The following is a fragment from the complete example for the IFileSaveAsDlg interface.
   ...
   // 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);
   ...