Solved

Opendialog Select Directory

Posted on 2002-03-27
2
333 Views
Last Modified: 2010-04-04
Is there a way to only select a directory without selecting a file using the OpenDialog or some other component? But it should be able to select files as well.

Thanx

Skynergy
0
Comment
Question by:skynergy
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 6903813
hi,
yes you can use SHBrowseForFolder() with the ulFlag set to BIF_BROWSEINCLUDEFILES

example:

uses activex,shlobj;

procedure TForm1.Button1Click(Sender: TObject);
var
pi: PItemIDList;
selected : array[0..MAX_PATH] of Char;
bi : TBrowseInfo;
begin
FillChar(bi,SizeOf(bi),#0);
bi.pszDisplayName := @selected[0];
bi.lpszTitle := 'Please Select a Folder';
bi.ulFlags := BIF_BROWSEINCLUDEFILES;
pi := SHBrowseForFolder(bi);
if Assigned(pi) then begin
if SHGetPathFromIDList(pi,selected) then
ShowMessage(selected);
end
else ShowMessage('no selection');
CoTaskMemFree(pi);
end;


Regards Barry
0
 

Author Comment

by:skynergy
ID: 6966845
Thanx Barry!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 154
delphi exception 7 64
Virtuailstring tree add node to another virtuailstring tree list 4 115
can i put an image from resource into image tag ? 6 25
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question