sorry, the backslash key sticks on this computer. the string should have read: '%HOMEDRIVE%%HOMEPATH%\My Documents'.

thank you for correcting me, and for your charitable remarks.

my apologies to Wilfred, and to the list.

[EMAIL PROTECTED] wrote:

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.


Except for the support calls when users can't find their documents anymore. "My Documents" is a localized name. The real string might by "Mis Documentos," or "Documenten." As soon as you use the term "hard-code," you're asking for trouble.

If you want the My Documents folder, there are functions in Windows specifically designed to tell you where it is. The only excuse to not use them is ignorance. I even wrap them into easy-to-call Delphi functions on my Web site.

Building the strings yourself is also prone to error. For instance, that string above will resolve to "C:\Documents and Settings\RobMy Documents" on my computer. Notice anything missing from that string? On my other computer, it will resolve to just "My Documents" since neither environment variable is set.

The location of the My Documents folder can be customized. (Look at the folder's Properties dialog.) It needn't have any relation to the user's home directory.


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

Reply via email to