LDialogFile::DoModalOpen

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalOpen(hWndOwner)

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

Parameters

HWND hWndOwner

Handle of the window which owns the dialog.

Returns

Value Meaning
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:

  • Canon RAW Format (*.crw)
  • DJVU (*.djv)
  • Kodak Digital Camera KDC (*.kdc)
  • Kodak Photo CD (*.pcd)
  • Profession Digital Camera (*.dcr)

The File Open dialog.

Required DLLs and Libraries

See Also

Functions

Topics

Example

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; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Common Dialog C++ Class Library Help