Solved

Browse Dialog

Posted on 1997-07-08
3
284 Views
Last Modified: 2010-04-06
Sometime in software, we see a browse dialog that enable us to chose a folder, not a file like open dialog do. So, I want to know how to call that dialog within delphi 3.
0
Comment
Question by:fmichaud061597
3 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1338491
use the SHBrowseForFolder to Displays a dialog box that enables the user to select a folder
see API documentation.
0
 

Author Comment

by:fmichaud061597
ID: 1338492
I'd like to have an example on how to use it, and what unit declares that procedure.
0
 
LVL 3

Accepted Solution

by:
sperling earned 50 total points
ID: 1338493
Here's a part of an util of mine using ShBrowseForFolder.

----
uses
  .....

  ShlObj, ActiveX;


procedure TForm1.ButtonBrowseClick(Sender: TObject);
var
  bi      : TBrowseInfo;
  idl     : POINTER;
  im      : IMAlloc;
begin
  Application.NormalizeTopMosts;
  with bi do begin
    hWndOwner := Handle;
    pidlRoot := nil;
    pszDisplayName := StrAlloc(MAX_PATH);
    lpszTitle := 'Select IIS Log file folder';
    ulFlags := BIF_RETURNONLYFSDIRS;
    lpfn := nil;
    lParam := 0;
    iImage := 0;
  end;
  idl := ShBrowseForFolder ( bi );
  Application.RestoreTopMosts;
  if idl<>nil then begin
    ShGetPathFromIDList(idl, bi.pszDisplayName);
    EditLogDir.Text := StrPas(bi.pszDisplayName);
  end;
  StrDispose(bi.pszDisplayName);
  ShGetMalloc(im);
  im.Free(idl);
end;
----

Regards,

Erik.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now