LDialogFile::DoModalGetDirectory

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalGetDirectory(hWndOwner)

Displays the Get Directory dialog box, and allows the user to browse the file system for a folder or directory.

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

The Get Directory dialog.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LDialogFile_DoModalGetDirectoryExample(LBitmap * pBitmap, HWND hWnd)  
{ 
   L_INT nRet; 
 
   LDialogFile DlgFile;  
 
   nRet = LDialogFile::Initialize (0);  
   if(nRet != SUCCESS) 
      return nRet; 
 
   DlgFile.SetBitmap (pBitmap);  
 
   GETDIRECTORYDLGPARAMS DlgParams;  
 
   L_TCHAR szDirectory [ L_MAXPATH ];  
 
   memset ( &DlgParams, 0, sizeof ( GETDIRECTORYDLGPARAMS ) ) ;  
 
   lstrcpy ( szDirectory, MAKE_IMAGE_PATH(TEXT(""))) ;  
 
   DlgParams.uStructSize      = sizeof ( GETDIRECTORYDLGPARAMS ) ;  
   DlgParams.pszDirectory = szDirectory ;  
   DlgParams.nBuffSize    = L_MAXPATH ;  
   DlgParams.pszFilter    = TEXT("ALL\0*.*\0LEAD\0*.cmp\0JPEG\0*.JPG\0") ;  
   DlgParams.nFilterIndex = 1 ;  
   DlgParams.pszTitle     = TEXT("Select a Directory Please"); 
 
   DlgFile.EnableCallBack (FALSE);  
   DlgFile.EnablePreview(TRUE);  
   DlgFile.EnableAutoProcess (TRUE);  
   DlgFile.EnableToolbar(TRUE);  
 
   nRet = DlgFile.SetDirectoryParams(&DlgParams) ;  
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = DlgFile.DoModalGetDirectory(hWnd);  
   if(nRet < 1) 
      return nRet; 
 
   // Gets the updated values for the structure 
 
   nRet = DlgFile.GetDirectoryParams (&DlgParams, sizeof(DlgParams)) ;  
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = LDialogFile::Free (); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 20.0.2019.9.19
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Common Dialog C++ Class Library Help