简体   繁体   中英

Capturing folder path from Windows Explorer

I would like to add to a Delphi application a way for the user to call Windows Explorer (possibly using something like ShellExecute, perhaps).

However, and this is where I need some help, please, the application would need to capture ^H^H^H^H^H^H read the folder path that the user navigates to while within Windows Explorer.

Is it possible to obtain this information from Windows Explorer?

[edit: If not possible, or unrealistic, my fallback plan is to provide a separate "Browse for folder" button, to allow the user to select the folder first, then they can launch the Window explorer afterwards].

Thanks for any advice. PhilW.

I dont know your exact needs, but most likely, this is not the way to go. For details, Microsoft developer Raymond Chen has written a blog post about this. What you should do, I think, is to embed an explorer browser control in a custom form in your own application.

For letting a user browse to and select a folder, I use TOrtusShellBrowseFolder.

Ortus Shell Components

Can't you just use the TOpenDialog? From Delphi Help:

Description

TOpenDialog displays a modal Windows dialog box for selecting and opening files. The dialog does not appear at runtime until it is activated by a call to the Execute method. When the user clicks Open, the dialog closes and the selected file or files are stored in the Files property.

if OpenDialog1.Execute then
   filename := OpenDialog1.FileName;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM