//Dir dialog analoog aan File Dialog //Geschreven door DAC, modificatie door Rvb 12-04-1999 // Updated on 11/03/2017 by Sergey V. Natarov (Modern Style) Use Windows.pkg Struct tBrowseInfo Handle hWndOwner Pointer pIDLRoot Pointer pszDisplayName Pointer lpszTitle DWord ulFlags Pointer lpfnCallback DWord lParam DWord iImage End_Struct // tBrowseInfo #IFNDEF GET_SHBrowseForFolderEx External_Function SHBrowseForFolderEx "SHBrowseForFolder" shell32.dll Pointer lpdpoints Returns DWord #ENDIF #IFNDEF GET_SHGetPathFromIDListEx External_Function SHGetPathFromIDListEx "SHGetPathFromIDList" shell32.dll Pointer pidList Pointer lpBuffer Returns DWord #ENDIF Class AbstractDirDialog Is an DFControl Procedure Construct_Object Forward Send Construct_Object Property String Dialog_Caption Public Property String Dir_Name Public Set Focus_Mode To No_Activate End_Procedure Function Show_Dialog Returns Integer String sFolder sDialogCaption sInitDir Pointer lpItemIdList lpsFolder lpsBrowseInfo lpsTitle Integer iFolderSelected tBrowseInfo ltBrowseInfo Get Dialog_Caption to sDialogCaption If (sDialogCaption<>"") Begin GetAddress of sDialogCaption to lpsTitle Move lpsTitle to ltBrowseInfo.lpszTitle End Move (Repeat(Character(0), 128)) to sFolder GetAddress of sFolder to lpsFolder Move (AddressOf(ltBrowseInfo)) to lpsBrowseInfo Move (SHBrowseForFolderEx(lpsBrowseInfo)) to lpItemIdList Move (SHGetPathFromIDListEx(lpItemIdList, lpsFolder)) to iFolderSelected If (iFolderSelected<>0) Set Dir_Name to (CString(sFolder)) Else Set Dir_Name to "" Function_Return (iFolderSelected<>0) End_Function End_Class Class OpenDirDialog Is an AbstractDirDialog End_Class