LDialogFile::DoModalSave

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalSave(hWndOwner)

HWND hWndOwner;

/* handle of the window which owns the dialog */

Displays the Save dialog box, and gets the options for LDialogFile::DoModalSave.

Parameter

Description

hWndOwner

Handle of the window which owns the dialog.

Returns

SUCCESS_DLG_OK

The "OK" button was pressed, and the dialog exited successfully.

SUCCESS_DLG_CANCEL

The "Cancel" button was pressed, and the dialog exited successfully.

< 1

An error occurred. Refer to Return Codes.

Comments

LDialogFile::SetSaveParams must be called before using this function to set the initial values for the dialog. You can get the updated SAVEDLGPARAMS with the values entered by the user through the dialog by using LDialogFile::GetSaveParams.

Note: The format listed below is only supported in 32-bit platforms:

The Save dialog.

Required DLLs and Libraries

LTDLGFILE
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTFIL
LTDIS
LTIMG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

Class Members, LDialogFile::GetSaveParams, LDialogFile::SetSaveParams, LBase::EnableCallBack, LDialogBase::EnablePreview, LDialogBase::EnableAutoProcess, LDialogBase::EnableToolbar, LDialogBase::Free, LDialogBase::Initialize, LBitmapBase::Save, LBitmapList::Save, LFile::SaveOffset, LFile::SaveTile

Topics:

Using Imaging Common Dialog

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LDialogFile_DoModalSaveExample(LBitmap * pBitmap, HWND hWnd)
{
   L_INT nRet = 0;
   LDialogFile DlgFile;
   DlgFile.SetBitmap (pBitmap);
   nRet = LDialogFile::Initialize (0);
   if(nRet != SUCCESS)
      return nRet;
   SAVEDLGPARAMS DlgParams ;  
   OPENFILENAME  OpenFileName ;
   memset ( &DlgParams, 0, sizeof ( SAVEDLGPARAMS ) ) ;
   OpenFileName.lStructSize     = sizeof ( OPENFILENAME ) ; 
   OpenFileName.lpstrInitialDir = NULL; 
   OpenFileName.lpstrTitle      = TEXT("Save a File");
   OpenFileName.nFilterIndex    = 0 ; 
   DlgParams.uStructSize       = sizeof (SAVEDLGPARAMS) ; 
   DlgParams.nQFactor    = 2 ; 
   DlgParams.nPageNumber = 1 ; 
   DlgParams.uSaveMulti  = MULTIPAGE_OPERATION_REPLACE ; 
   DlgParams.uDlgFlags   = DLG_SAVE_SHOW_FILEOPTIONS_PROGRESSIVE     |
                           DLG_SAVE_SHOW_FILEOPTIONS_MULTIPAGE       |
                           DLG_SAVE_SHOW_FILEOPTIONS_STAMP           |
                           DLG_SAVE_SHOW_FILEOPTIONS_QFACTOR         |
                           DLG_SAVE_SHOW_FILEOPTIONS_J2KOPTIONS      |
                           DLG_SAVE_SHOW_FILEOPTIONS_BASICJ2KOPTIONS ; 
   DlgFile.EnableCallBack (FALSE); 
   nRet = DlgFile.SetSaveParams (&DlgParams) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgFile.SetFileName(MAKE_IMAGE_PATH(TEXT("Out_IMAGE1.GIF"))) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgFile.DoModalSave(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgFile.GetSaveParams(&DlgParams, sizeof(DlgParams)) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = LDialogFile::Free ();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}