win32 interface: enable new style select directory dialog, which has a button for creating new directories from YHernan (#9860)

git-svn-id: trunk@12383 -
This commit is contained in:
vincents 2007-10-08 14:12:13 +00:00
parent 93c9981240
commit a9f96510dc
2 changed files with 13 additions and 1 deletions

View File

@ -174,6 +174,13 @@ const
{ BrowseForFolder dialog}
BIF_RETURNONLYFSDIRS = 1;
BIF_NEWDIALOGSTYLE = $40;
//Version 5.0. Use the new user interface. Setting this flag provides the
//user with a larger dialog box that can be resized. The dialog box has
//several new capabilities, including: drag-and-drop capability within the
//dialog box, reordering, shortcut menus, new folders, delete, and other
//shortcut menu commands. To use this flag, you must call OleInitialize or
//CoInitialize before calling SHBrowseForFolder.
BFFM_INITIALIZED = 1;
BFFM_SELCHANGED = 2;

View File

@ -639,16 +639,19 @@ begin
end;
Result := 0;
end;
class function TWin32WSSelectDirectoryDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
var
bi : TBrowseInfo;
Options: TOpenOptions;
Buffer : PChar;
iidl : PItemIDList;
InitialDir: string;
begin
Buffer := CoTaskMemAlloc(MAX_PATH);
InitialDir := TSelectDirectoryDialog(ACommonDialog).FileName;
Options := TSelectDirectoryDialog(ACommonDialog).Options;
if length(InitialDir)=0 then
InitialDir := TSelectDirectoryDialog(ACommonDialog).InitialDir;
if length(InitialDir)>0 then begin
@ -666,6 +669,8 @@ begin
pszDisplayName := Buffer;
lpszTitle := PChar(ACommonDialog.Title);
ulFlags := BIF_RETURNONLYFSDIRS;
if not (ofOldStyleDialog in Options) then
ulFlags := ulFlags + BIF_NEWDIALOGSTYLE;
lpfn := @BrowseForFolderCallback;
// this value will be passed to callback proc as lpData
lParam := LclType.LParam(PChar(InitialDir));