The CSIDL value for the Program Files directory is Csidl_Program_Files.
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/enums/csidl.asp
 
Thanks Rob, I spotted that resource. 
Note however that the Microsoft constants will work only if they are declared 
in the ShallObj unit(but the raw integer value will in any case).
Check the ShallObj unit for contants declared in Delphi.
 

function GetMyDocs: string ;
// Needs "shlobj, windows" in USES clause
var
  ppidl: PItemIdList;
  PerDir: string;
begin
  ppidl := nil;
  SHGetSpecialFolderLocation(0, CSIDL_PERSONAL, ppidl);
  SetLength(perdir, MAX_PATH);
  if not SHGetPathFromIDList(ppidl, PChar(perdir)) then
        raise exception.create('Could not find your default documents 
folder');
  //endif
  SetLength(perdir, lStrLen(PChar(perdir))); 
  Result := perdir ;
end;
-----------------
Tony, I ended up with something similar and it works fine, but not always and 
not
for all folders. For some folders and applications I have an "acces violation" 
error.
In the ShallObj Unit it is said that the "Imalloc" should be used (when using   
SHGetSpecialFolderLocation ) to make sure the
handle is released. Anybody has any suggestion on this?
 
marco


Marco Congedo, PhD 
-------------------------------
INRIA
(National Institute for Research in Informatics and Control)
Grenoble, France 
Tel: +33 4 76615409
Fax: +33 4 76615454


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to