I think perhaps this might be what you are looking for:

////////////////////BEGIN
CODE//////////////////////////////////////////////////////

Function TMainF1.GetSpecialFolder(Const FolderId: integer): String;
// Return the full path to the requested folder.  FolderId should be one of
the //
//ShlObj.pas CSIDL_ constants such as CSIDL_APPDATA.
Var
    ppidl: PItemIdList;
Begin
    If SHGetSpecialFolderLocation(0, FolderId, ppidl) = NOERROR Then
    Begin
        SetLength(Result, MAX_PATH);
        If SHGetPathFromIDList(ppidl, PChar(Result)) Then
            SetLength(Result, StrLen(PChar(Result)))
        Else
            Result := '';
    End
    Else
        Result := '';
End;

////////////////////END
CODE///////////////////////////////////////////////////////

        I've used this before and if I remember correctly the list of
available constants can be found in Sysutils.  I'm on my laptop right now so
I can't check for sure, but the constant I used to get the currently logged
on user's personal directory was  "GetSpecialFolder($0023);"
        I hope this helps!

from: Robert Meek at: [EMAIL PROTECTED] 
dba "Tangentals Design" home of "PoBoy"
freeware Windows apps and utilities
located at: www.TangentalsDesign.com
e-mail to:
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Peter Laman
Sent: Monday, June 20, 2005 3:11 AM
To: Delphi-Talk Discussion List
Subject: RE: user directory

Dan Kloke wrote:

<well, for example if one wants to have a SaveDialog or OpenDialog 
default to the users My Documents folder (instead of the program's 
installation folder, one can  hard-code the  InitialDir property to 
'%HOMEDRIVE%%HOMEPATH%My Documents'. No call of any kind is made.>

Ok, but that doesn't always work. For example, you can set the directory
name to a different name. XP renders 'My Documents' and 'Peter's Documents',
so I'm not sure that will work.

Peter Laman
Senior Software Engineer
Lance ICT Group
Roermond, the Netherlands
http://www.lance-safety.com

----
----

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk


__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to