title: delphi get folder path
body: <p>I m working with Delphi 7 and I want to find out the path of my <strong>.. /All Users/Documents</strong> directory.<br>
  I came across the following code </p>
  
  <pre><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;
  </code></pre>
  
  <p>It works fine but it does not support <code>CSIDL_COMMON_DOCUMENTS</code> which returns the desired path.  </p>
  
  <p>Moreover as per MS <a href="http://msdn.microsoft.com/en-us/library/bb762494%28VS.85%29.aspx">CSIDL</a> should no longer be used instead use <a href="http://msdn.micrhttp://msdn.microsoft.com/en-us/library/dd378457%28v=VS.85%29.aspx">KNOWNFOLDERID</a> .<br>
  And I do need to work this app on multiple OS's (only windows).  </p>
  
  <p>How can I do this ?<br>
  Help is appreciated :)</p>