Bonjour,
je voudrais récupérer le nom du répertoire Téléchargements de W10. ça parait simple, mais je n'y arrive pas !
J'ai vu qu'il fallait utiliser SHGetKnownFolderPath, alors j'ai fait :
Mais SHGetKnownFolderPath et CoTaskMemFree sont inconnus de D7 ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 // Code de : https://github.com/yypbd/yypbd-Delphi-Libs/blob/master/lib/ShellKnownPath.pas Uses ... ,Shlobj, SHFolder; Const FOLDERID_Downloads: TGUID = '{374DE290-123F-4565-9164-39C4925E467B}'; // Je pense utiliser celui-ci FOLDERID_PublicDownloads: TGUID = '{3D644C9B-1FB8-4f30-9B45-F670235F79C0}'; { ====================================================================== } function TF_Princ.GetFolderPathW10(const AFolderID: TGUID): string; var hr: HRESULT; pszPath: PWideChar; begin Result := ''; hr := SHGetKnownFolderPath( AFolderID, 0, 0, pszPath ); if Succeeded(hr) then begin Result := pszPath; CoTaskMemFree( pszPath ); end; end; { ====================================================================== }
Quelqu'un saurait il le faire ?
Merci
A+
Charly
Partager