Displays the Get Directory dialog box, and allows the user to browse the file system for a folder or directory.
#include "ltwrappr.h"
virtual L_INT LDialogFile::DoModalGetDirectory(hWndOwner)
Handle of the window which owns the dialog.
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. |
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.
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;
}