SelectDirectory / ShBrowseForFolder problem when there are a lot of shell elements

I got confused by a very strange problem with the Vcl.FileCtrl SelectDirectory function (which is a thin shell in the ShBrowseForFolder Win32 API).

I use the following code to allow the user to view a file or folder:

  if SelectDirectory('Sélectionnez un élément à ajouter :', '', S, [sdNewFolder,
    sdShowFiles, sdNewUI]) then

When this code is executed, the Browse Folder dialog box appears, displaying the contents of the user's desktop:

SelectDirectory with less than 100 desktop files

But when the number of items in the Desktop folder is too large (on my computer I can reproduce the problem with about 100 icons on the desktop), the same call creates a completely different display:

SelectDirectory with more than 100 desktop files

. , " ", / .

, . , ? , , , , , . , - Delphi, API, MSDN...

!

+5
2

, , - "" (Win XP) , , [sdNewUI]. .

, , , , - TFileOpenDialog .

+1

, . Windows, API . , SHBrowseForFolder . SHBrowseForFolder API.

, IFileOpenDialog . , Vista. Delphi TFileOpenDialog. , Win32MajorVersion>=6 ! XP SHBrowseForFolder.

if Win32MajorVersion>=6 then
begin
  FileOpenDialog1.Title := 'Sélectionnez un élément à ajouter :';
  FileOpenDialog1.Options := FileOpenDialog1.Options + [fdoPickFolders];
  if FileOpenDialog1.Execute then
    Beep;
end else
begin
  // revert to SelectDirectory
end;
+7

All Articles