1. Computing & Technology
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?

Discuss in my forum

©2012 About.com. All rights reserved.

A part of The New York Times Company.