Alternative to SelectDirectory() function ?

[b][red]This message was edited by GarryPaxton at 2004-12-19 10:25:7[/red][/b][hr]
I wish to browse for a directory, rather than a file, so I have been using the SelectDirectory() function in Delphi 6, which gives me the following warning message at compile-time...

[Warning].....Unit 'FileCtrl is specific to a platform.

I can live with this for now, but the dialog box itself look old ... it looks like a Windows 3.1 style. Furthermore, it is quite limited in function (For example, I cannot search "My Network Places")

Is there a more modern version of SelectDirectory() function I can use, please ?


many thanks



Comments

  • : [b][red]This message was edited by GarryPaxton at 2004-12-19 10:25:7[/red][/b][hr]
    : I wish to browse for a directory, rather than a file, so I have been using the SelectDirectory() function in Delphi 6, which gives me the following warning message at compile-time...
    :
    : [Warning].....Unit 'FileCtrl is specific to a platform.
    :
    : I can live with this for now, but the dialog box itself look old ... it looks like a Windows 3.1 style. Furthermore, it is quite limited in function (For example, I cannot search "My Network Places")
    :
    : Is there a more modern version of SelectDirectory() function I can use, please ?
    :
    :
    : many thanks
    :
    :
    :
    :
    Not that I know of, but you can always create a new function based on a TForm. This allows you to control the appearance and data of that dialog box.
  • : [b][red]This message was edited by GarryPaxton at 2004-12-19 10:25:7[/red][/b][hr]
    : I wish to browse for a directory, rather than a file, so I have been using the SelectDirectory() function in Delphi 6, which gives me the following warning message at compile-time...
    :
    : [Warning].....Unit 'FileCtrl is specific to a platform.
    :
    : I can live with this for now, but the dialog box itself look old ... it looks like a Windows 3.1 style. Furthermore, it is quite limited in function (For example, I cannot search "My Network Places")
    :
    : Is there a more modern version of SelectDirectory() function I can use, please ?
    :
    :
    : many thanks
    :
    :
    You can use this stuff in the ShlObj unit. SelectDirectory in FileCtrl uses this also, but you can tune it yourself this way.
    [code]
    var
    BrowseInfo: TBrowseInfo;
    begin
    FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
    BrowseInfo.ulFlags := BIF_NEWDIALOGSTYLE;
    SHBrowseForFolder(BrowseInfo);
    end;
    [/code]
    You can search My Network Places like this.


  • [b][red]This message was edited by GarryPaxton at 2004-12-29 13:39:39[/red][/b][hr]
    [b][red]This message was edited by GarryPaxton at 2004-12-29 12:5:44[/red][/b][hr]
    : : [b][red]This message was edited by GarryPaxton at 2004-12-19 10:25:7[/red][/b][hr]
    : : I wish to browse for a directory, rather than a file, so I have been using the SelectDirectory() function in Delphi 6, which gives me the following warning message at compile-time...
    : :
    : : [Warning].....Unit 'FileCtrl is specific to a platform.
    : :
    : : I can live with this for now, but the dialog box itself look old ... it looks like a Windows 3.1 style. Furthermore, it is quite limited in function (For example, I cannot search "My Network Places")
    : :
    : : Is there a more modern version of SelectDirectory() function I can use, please ?
    : :
    : :
    : : many thanks
    : :
    : :
    : You can use this stuff in the ShlObj unit. SelectDirectory in FileCtrl uses this also, but you can tune it yourself this way.
    : [code]
    : var
    : BrowseInfo: TBrowseInfo;
    : begin
    : FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
    : BrowseInfo.ulFlags := BIF_NEWDIALOGSTYLE;
    : SHBrowseForFolder(BrowseInfo);
    : end;
    : [/code]
    : You can search My Network Places like this.
    :
    :
    :
    Hi , thanks for that....but I have a dumb question. Coded as you have suggested above, I get "undeclared identifier: 'BIF_NEWDIALOGSTYLE' ", could not compile, etc, even with ShlObj in my USES section...what have I done wrong, please ? Just to get it compile I used
    [code]BrowseInfo.ulFlags := 0;[/code]
    but it would be nice to know what the flags represent.... Help gives me nothing.

    many thanks, cos it looks ideal

    P.S....I'm not sure how to then retrieve the selected directory name !






  • : [b][red]This message was edited by GarryPaxton at 2004-12-29 13:39:39[/red][/b][hr]
    : [b][red]This message was edited by GarryPaxton at 2004-12-29 12:5:44[/red][/b][hr]
    : : : [b][red]This message was edited by GarryPaxton at 2004-12-19 10:25:7[/red][/b][hr]
    : : : I wish to browse for a directory, rather than a file, so I have been using the SelectDirectory() function in Delphi 6, which gives me the following warning message at compile-time...
    : : :
    : : : [Warning].....Unit 'FileCtrl is specific to a platform.
    : : :
    : : : I can live with this for now, but the dialog box itself look old ... it looks like a Windows 3.1 style. Furthermore, it is quite limited in function (For example, I cannot search "My Network Places")
    : : :
    : : : Is there a more modern version of SelectDirectory() function I can use, please ?
    : : :
    : : :
    : : : many thanks
    : : :
    : : :
    : : You can use this stuff in the ShlObj unit. SelectDirectory in FileCtrl uses this also, but you can tune it yourself this way.
    : : [code]
    : : var
    : : BrowseInfo: TBrowseInfo;
    : : begin
    : : FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
    : : BrowseInfo.ulFlags := BIF_NEWDIALOGSTYLE;
    : : SHBrowseForFolder(BrowseInfo);
    : : end;
    : : [/code]
    : : You can search My Network Places like this.
    : :
    : :
    : :
    : Hi , thanks for that....but I have a dumb question. Coded as you have suggested above, I get "undeclared identifier: 'BIF_NEWDIALOGSTYLE' ", could not compile, etc, even with ShlObj in my USES section...what have I done wrong, please ? Just to get it compile I used
    : [code]BrowseInfo.ulFlags := 0;[/code]
    : but it would be nice to know what the flags represent.... Help gives me nothing.
    :
    : many thanks, cos it looks ideal
    :
    : P.S....I'm not sure how to then retrieve the selected directory name !
    :
    The selected directory will appear as field in the BrowseInfo. See the BrowseInfo structure in the Win API help files.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories