1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

SelectDirectory

unit
Dialogs
category
Dialog and Message routines

declaration
function SelectDirectory(const Caption; const Root : widestring; out Directory: string): boolean;

description
SelectDirectory function brings up a dialog box ready for the user to select a directory name.

SelectDirectory function is an encapsulation of the BrowseForFolder Windows API function.
The dialog box includes an "OK" and a "Cancel" button, if the user presses the "Cancel" button the function returns False. If the user presses the "OK" button the function returns the directory selected in a Directory parameter. When the dialog is displayed it uses the Root parameter as the directory from which to browse. Caption is the message of the dialog, not the caption, the dilaog caption is "Browse For Folder".

example
var dir : widestring;

if SelectDirectory('My message','d:\!gajba',dir) then
showmessage('Folder selected ' + dir);

in real code
Browse for Computers, Folders, Files and Printers
Use Delphi (and API) to display the directory structure of a computer and allow a user to select a folder without using the Common Dialog control. Plus: select a printer or network computer.

see also
DirectoryExists,InputBox, InputQuery


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.