Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to Implement a Win32 look and feel "Browse for Folder" directory picker Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
10-Oct-02
Category
Files Operation
Language
Delphi 2.x
Views
129
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

I'm looking for code that will let me implement a Win32 look and feel "Browse for 
Folder" directory picker. Like the one used in Project Options - > Directories/ 
Conditionals interface.

Answer:
1   
2   procedure TMainForm.BrowseFolderActionExecute(Sender: TObject);
3   var
4     pidl, pidlSelected: PItemIDList;
5     bi: TBrowseInfo;
6     szDirName: array[0..260] of AnsiChar;
7   begin
8     {Get the root PIDL of the network neighborhood tree}
9     if SHGetSpecialFolderLocation(Handle, CSIDL_DESKTOP, pidl) = NOERROR then
10    begin
11      {Populate a BROWSEINFO structure}
12      bi.hwndOwner := Handle;
13      bi.pidlRoot := pidl;
14      bi.pszDisplayName := szDirName;
15      bi.lpszTitle := 'Select directory';
16      bi.ulFlags := BIF_RETURNONLYFSDIRS;
17      bi.lpfn := nil;
18      bi.lParam := 0;
19      bi.iImage := -1;
20      {Display the "Browse For Folder" dialog box}
21      pidlSelected := SHBrowseForFolder(bi);
22      {NULL indicates that Cancel was selected from the dialog box}
23      if pidlSelected < > nil then
24      begin
25        SHGetPathFromIDList(pidlSelected, szDirName);
26        ShowMessage(szDirName);
27        {Release the PIDL of the computer name}
28        CoTaskMemFree(pidlSelected);
29      end;
30      {Release the PIDL of the network neighborhood tree}
31      CoTaskMemFree(pidl);
32    end;
33  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC