#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. |
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. |
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.
Required DLLs and Libraries
LTDLGFILE For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
#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;
}