LDialogFile::DoModalGetDirectory

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalGetDirectory(hWndOwner)

HWND hWndOwner;

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

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

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::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 is shown in the following figure:

image\GetDirectory.gif

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::GetDirectoryParams, LDialogFile::SetDirectoryParams, LBase::EnableCallBack, LDialogBase::EnablePreview, LDialogBase::EnableAutoProcess, LDialogBase::EnableToolbar, LDialogBase::Free, LDialogBase::Initialize

Topics:

Using Imaging Common Dialog

Example

void TestFunction(LBitmap * pBitmap, HWND hWnd) 
{
   LDialogFile DlgFile; 
   LDialogFile::Initialize (0); 
   DlgFile.SetBitmap (pBitmap); 
   
   GETDIRECTORYDLGPARAMS DlgParams; 
   L_TCHAR szDirectory [ L_MAXPATH ]; 
   memset ( &DlgParams, 0, sizeof ( GETDIRECTORYDLGPARAMS ) ) ; 
   lstrcpy ( szDirectory, TEXT("C:\\images") ) ; 
   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); 
   DlgFile.SetDirectoryParams(&DlgParams) ; 
   DlgFile.DoModalGetDirectory(hWnd); 

   // Gets the updated values for the structure
   DlgFile.GetDirectoryParams (&DlgParams, sizeof(DlgParams)) ; 
   LDialogFile::Free ();
}