I m working with Delphi 7 and I want to find out the path of my .. /All Users/Documents directory.
I came across the following code
uses shlobj, ...
function GetMyDocuments: string;
var
r: Bool;
path: array[0..Max_Path] of Char;
begin
r := ShGetSpecialFolderPath(0, path, CSIDL_Personal, False) ;
if not r then
raise Exception.Create('Could not find MyDocuments folder location.') ;
Result := Path;
end;
It works fine but it does not support CSIDL_COMMON_DOCUMENTS
which returns the desired path.
Moreover as per MS CSIDL should no longer be used instead use KNOWNFOLDERID .
And I do need to work this app on multiple OS's (only windows).
How can I do this ?
Help is appreciated :)
CSIDL_COMMON_DOCUMENTS
deceleration in myShlobj.pas
file. – Tinned