Reputation: 1611
I am using SHGetSpecialFolderPath
to retrieve some Windows special folders with Delphi 7. Here is some code sample:
const
CSIDL_DESKTOP = $0000;
CSIDL_PERSONAL = $0005;
CSIDL_MYPICTURES = $0027;
CSIDL_MYMUSIC = $000d;
CSIDL_MYVIDEO = $000e;
CSIDL_WINDOWS = $0024;
CSIDL_SYSTEM = $0025;
function GetSpecialFolderPath(Folder: Integer; ForceDir: Boolean): string;
// Uses ShlObj
var
Path: array [0..255] of char;
begin
SHGetSpecialFolderPath(0, @Path[0], Folder, ForceDir);
Result := Path;
end;
edtFolder.Text := GetSpecialFolderPath(CSIDL_DESKTOP, False);
How can I get the "Downloads" folder with this approach?
Upvotes: 1
Views: 5820
Reputation: 163247
You cannot get that directory with that API. It predates any OS-designated download folder.
You'll need to use the newer notion of "known folders" with the flag FOLDERID_Downloads
instead. How to do that has already been answered elsewhere on Stack Overflow.
Upvotes: 7