Unit FoldrDlg

TFolderDialog Component for Borland Delphi 32 wraps the Windows 95/NT 4.0+ Shell32 dialog 'Browse For Folder' into a true native, customizable and extendable Delphi component. Copyright (C) 1997 Fred de Jong - Heerlen - Netherlands This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. FoldrDlg.pas - 12 October 1997, 26 Oct 1997 Most ideas and parts of this source originate from the freeware TBrowseFolder component written by: - Todd Fast, Pencilneck Software, tfast@eden.com, pencilneck@hotmail.com http://www.eden.com/~tfast/pencilneck.html - Alin Flaider, aflaidar@datalog.ro - Ahto Tanner, ahto@moonsoftware.ee, http://www.moonsoftware.ee - Manuel Duarte It was redesigned to a Delphi 'naturalized' TFolderDialog and brought under the 'GNU Library General Public License' by: - Fred de Jong, frejon@worldonline.nl, fjng@cbs.nl The TFolderDialog librarycomponent is CopyLefted software, see accompanying COPYLIB.htm text, added to this distribution, and: http://agnes.dida.physik.uni-essen.de/gnu/copyleft/lgpl.html For Free Software Foundation, see: http://agnes.dida.physik.uni-essen.de/gnu/fsf/fsf.html 11 Oct 97: Added support for any custombutton derived from TButtonControl. Added bfResizeCustomButton Option (def. off). 26 Oct 97: fdj: Support Delphi 2 without the need to modify source (except for DELPHI2 define). Added Option bfBrowseIncludeFiles to allow TFolderDialog to show files in it's common browse treeview too. *) // Uncomment next line for Delphi 2.0x //{$DEFINE DELPHI2} {$BOOLEVAL OFF} // {$DEFINE SICMPLIB

Classes

TFolderDialog - TFolderDialog is a shell supplied task modal dialog with active events and customizable buttoncontrol

Functions

GetIDListFromPath - Note: GetIDListFromPath returned ItemIDList must be freed with CoTaskMemFree(ItemIDList)

{$IFNDEF DELPHI2} procedure GetNetResourceFromIDList(const ItemIDList: PItemIDList; var NetResource: TNetResource): boolean; { ItemIDList must be relative to network (not neighborhood) folder } var Buf: record NR: TNetResource; B: array[0.
GetPathFromIDList -
Register -

Types

TFolderDialogOption
TFolderDialogOptions
TShellFolder

Constants

Variables


Functions


procedure GetIDListFromPath(Path: String; var ItemIDList: PItemIDList);

Note: GetIDListFromPath returned ItemIDList must be freed with CoTaskMemFree(ItemIDList)

{$IFNDEF DELPHI2} procedure GetNetResourceFromIDList(const ItemIDList: PItemIDList; var NetResource: TNetResource): boolean; { ItemIDList must be relative to network (not neighborhood) folder } var Buf: record NR: TNetResource; B: array[0..1024] of byte; end; RootPIDL: PItemIDList; begin Result:= false; if SHGetSpecialFolderLocation(Application.Handle, CSIDL_NETWORK, RootPIDL) = NOERROR then try Result:= SHGetDataFromIDList(ParentPIDL, ItemIDList, SHGDFIL_NETRESOURCE, Buf, sizeof(Buf)) = NOERROR; if Result then System.Move(Buf.NR, NetResource, sizeof(NetResource)); finally CoTaskMemFree(RootPIDL) end; end; {$ENDIF}*) {Todd Fast:} {This procedure complements SHGetPathFromIDList in the Win32 API, and allows you to obtain a PIDL from a path string.


function GetPathFromIDList(const ItemIDList: PItemIDList; var Path: string): boolean;


procedure Register;


Types


TFolderDialogOption = (
       bfFileSysDirsOnly, bfDontGoBelowDomain, bfStatusText,
       bfFileSysAncestors, bfBrowseForComputer, bfBrowseForPrinter,
       bfBrowseIncludeFiles, { fdj 26-10 }
       { added extra browsefolder options: fdj }
       bfShowPathInStatusArea, bfSyncCustomButton, bfAlignCustomButton,
       bfScreenCenter, bfParentCenter, bfResizeCustomButton
       );

TFolderDialogOptions = set of TFolderDialogOption
fdj 26-10 } { added extra browsefolder options: fdj
TShellFolder = (sfoDesktopExpanded,sfoDesktop,sfoPrograms,sfoControlPanel,
    sfoPrinters,sfoPersonal,sfoFavorites,sfoStartup,sfoRecent,
    sfoSendto,sfoRecycleBin,sfoStartMenu,sfoDesktopDirectory,sfoMyComputer,
    sfoNetwork,sfoNetworkNeighborhood,sfoFonts,sfoTemplates
    {$IFNDEF DELPHI2}
    { sfoCommon* is for NT 4.0+ only: fdj }
    ,
    sfoCommonStartMenu, sfoCommonPrograms, sfoCommonStartup,
    sfoCommonDesktopDirectory, sfoAppData, sfoPrintHood
    {$ENDIF}
    );

Constants


Variables