I let my users select a folder via the OpenDialog component.
However, when they select a folder such as Documents or My Videos or something like that, the path is just the name of the folder.
I can get the path of such folder via the API, but how do I get the path based on what they've selected in the OpenDialog?
I believe that you are actually talking about a user selecting a Windows 7 library. In which case you need to use special code to find the default save location for that library.
You need to use the
IFileDialoginterface to do this. If you useTOpenDialogthen you don't have access to theIFileDialoginterface. So you need to use the Vista dialog,TFileOpenDialogwhich does expose theIFileDialoginterface.Once you have this interface you can obtain
IShellIteminterfaces for each selected shell item by callingGetResultsfor multi-select dialogs, andGetResultfor single-select dialogs. You can then pass theseIShellIteminterfaces to a function like this:The code in the Embarcadero libraries should be doing this, but sadly that library code is deficient. It should be supporting Windows 7 libraries by now.
Personally, I don't use the Embarcadero provided file dialogs because of this issue and others.