LDialogFile::DoModalOpen

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalOpen(hWndOwner)

HWND hWndOwner;

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

Displays the Open dialog box, and gets the options for LFile::Load.

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::SetOpenParams must be called before using this function to set the initial values for the dialog. You can get the updated OPENDLGPARAMS with the values entered by the user through the dialog by using LDialogFile::GetOpenParams.

Note: The formats listed below are only supported in 32-bit platforms:

The File Open 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::GetOpenParams, LDialogFile::SetOpenParams, LBase::EnableCallBack, LDialogBase::EnablePreview, LDialogBase::EnableAutoProcess, LDialogBase::EnableToolbar, LDialogBase::Free, LDialogBase::Initialize. LBitmapBase::Load

Topics:

Using Imaging Common Dialog

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
class MyFileDlg : public LDialogFile
{
public: 
   L_INT DialogOpenCallBack(LPOPENDLGFILEDATA lpFileData, L_INT nTotalPercent, L_INT nFilePercent); 
};
L_INT MyFileDlg::DialogOpenCallBack(LPOPENDLGFILEDATA lpFileData, L_INT nTotalPercent, L_INT nFilePercent) 
{
   if ( nFilePercent == 100 ) 
   {
      MessageBox ( NULL, lpFileData->szFileName, TEXT("File Loaded"), MB_OK ) ; 
   }
   if ( nTotalPercent == 100 ) 
   {
      MessageBox ( NULL, TEXT("File(s) Loading Completed"), TEXT("File(s) Loaded"), MB_OK ) ; 
   }
   return SUCCESS ; 
}
L_INT LDialogFile_DoModalOpenExample(LBitmap * pBitmap, HWND hWnd) 
{
   L_INT nRet = 0; 
   MyFileDlg DlgFile; 
   DlgFile.SetBitmap (pBitmap); 
   nRet = MyFileDlg::Initialize (0); 
   if(nRet != SUCCESS)
      return nRet;
   OPENFILENAME  OpenFileName; 
   OPENDLGPARAMS DlgParams ; 
   memset ( &OpenFileName, 0, sizeof ( OPENFILENAME ) ) ; 
   memset ( &DlgParams, 0, sizeof ( OPENDLGPARAMS ) ) ; 
   OpenFileName.lStructSize       = sizeof(OPENFILENAME); 
   OpenFileName.lpstrInitialDir   = NULL; 
   OpenFileName.Flags             = OFN_EXPLORER | 
                                    OFN_ALLOWMULTISELECT ; 
   DlgParams.uStructSize = sizeof ( OPENDLGPARAMS ) ; 
   DlgParams.bPreviewEnabled = TRUE; 
   DlgParams.uDlgFlags = DLG_OPEN_SHOW_PROGRESSIVE     |
                         DLG_OPEN_SHOW_MULTIPAGE       |
                         DLG_OPEN_SHOW_LOADROTATED     |
                         DLG_OPEN_SHOW_LOADCOMPRESSED  |
                         DLG_OPEN_SHOW_FILEINFO        |
                         DLG_OPEN_SHOW_PREVIEW         |
                         DLG_OPEN_SHOW_DELPAGE         |
                         DLG_OPEN_SHOW_LOADOPTIONS     |
                         DLG_OPEN_VIEWTOTALPAGES       |
                         DLG_OPEN_GENERATETHUMBNAIL ; 
   DlgFile.EnableCallBack (TRUE); 
   DlgFile.EnableAutoProcess (TRUE); 
   nRet = DlgFile.SetOpenParams (&DlgParams) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgFile.SetFileName (MAKE_IMAGE_PATH(TEXT("image1.cmp")));
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgFile.DoModalOpen(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgFile.GetOpenParams (&DlgParams, sizeof(DlgParams)) ; 
   if(nRet != SUCCESS)
      return nRet;
  //Get new values... 
  L_TCHAR  szFile[260]; 
  UINT  uSize = sizeof(szFile); 
  DlgFile.GetFileName (szFile, uSize); 
  nRet = MyFileDlg::Free ();
  if(nRet != SUCCESS)
     return nRet;
  return SUCCESS;
}