Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Opendialog Select Directory

Posted on 2002-03-27
2
Medium Priority
?
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

721 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