The "%userprofile%" portion of the directory string is a Windows environment
variable.
Some directory handling logic knows how to automatically replace those, some
doesn't, you may well have some that doesn't.
One possibility to try first: if the replacement value happens to contain
spaces, that can confuse some directory handling logic; so try putting double
quotes around the string.
Your example code would then become:
BaseDir := '"%userprofile%\documents"';
^ ^
[Note the embedded double quotes]
If that doesn't work, you may have to do the Environment Variable replacement
yourself.
The Windows API GetEnvironmentVariable() will retrieve the value associated
with %userprofile% and you can do your own replacement.
Conversely, use the ExpandEnvironmentStrings() API to perform the replacement
automatically.
Note that you should be sure to allocate a large enough destination buffer.
Environment variable values are typically considerably longer than their names.
Googling "Delphi GetEnvironmentVariable" or "Delphi ExpandEnvironmentStrings"
should get you several Delphi specific examples of how to use these calls.
HTH
Stephen Posey
[email protected]
-----Original Message-----
>From: Rich Cooper <[email protected]>
>Sent: Jul 22, 2014 6:28 PM
>To: 'Moderated List for the Discussion of Delphi Programming excluding
> Database-related topics' <[email protected]>
>Subject: RE: Running Delphi on 64-bit machines
>
>I am trying to set an initial directory to the code
> '%userprofile%\documents'
>
>Which is supposed to go to the current user's "Documents" folder (Win 7), but
>it blows up,
> with the exception "can't find file" as I step through the sequence.
>
>How do I set the Directory property of a TDirectoryListBox (such as
>dlSystemCEfP below) and
> still use the control?
>
> BaseDir := '%userprofile%\documents';
>
> dlSystemCEfP.Directory := BaseDir;
>
>The second statement always blows the TDirectoryListBox with "Can't find file"
>exception.
>
>Suggestions, corrections appreciated,
>-Rich
>
>Sincerely,
>Rich Cooper
>EnglishLogicKernel.com
>Rich AT EnglishLogicKernel DOT com
>9 4 9 \ 5 2 5 - 5 7 1 2
>
>-----Original Message-----
>From: Delphi [mailto:[email protected]] On Behalf Of Garth S.
>Wilcox
>Sent: Monday, June 09, 2014 4:11 PM
>To: Moderated List for the Discussion of Delphi Programming excluding
>Database-related topics
>Subject: Re: Running Delphi on 64-bit machines
>
>Now this is not about installing on a 64-bit machine.
>
>I am using VirtualBox (an Oracle free virtual machine manager). I
>installed Win 7 32-bit and had no issues installing Delphi 5. I did run
>the install.exe (or was it Setup.exe) as administrator
>
>I am in the process of setting up a virtual machine for all the versions
>of Delphi I own complete with the appropriate libraries. When I need to
>work with a project that requires a certain version, I'll clone the
>virtual machine and install the source.
>
>Garth
>
>
>On 6/8/2014 10:37 PM, Darin McGee wrote:
>> Yes, you can run a VMware (or Windows ) virtual machine of Windows XP on
>> Windows XP. Check out the VMware web site for all of the details.
>>
>> -----Original Message-----
>> From: Delphi [mailto:[email protected]] On Behalf Of Tony Foale
>> Sent: Sunday, June 08, 2014 9:51 AM
>> To: Moderated List for the Discussion of Delphi Programming excluding
>> Database-related topics
>> Subject: Re: Running Delphi on 64-bit machines
>>
>> On 7 June 2014 15:53, Michael Rothwell<[email protected]> wrote:
>>
>>
>>> A cool feature of the VM solution is that you can backup your VM
>>> (complete with your Win XP& Delphi installation) and restore it to
>>> another PC, and you are ready to go! So you will never have to
>>> reinstall Windows XP or Delphi 3 again.
>>>
>>>
>> That is cool. Can that be done on native XP installations?
>>
>>
>>
>> Regards
>>
>> Tony Foale
>>
>>
>>
>> [email protected]
>> http://www.tonyfoale.com
>> http://picasaweb.google.com/tonyfoale
>> https://www.facebook.com/tony.foale.5
>> https://www.youtube.com/user/MotoChassis
>> _______________________________________________
>> Delphi mailing list
>> [email protected]
>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>> _______________________________________________
>> Delphi mailing list
>> [email protected]
>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>>
>_______________________________________________
>Delphi mailing list
>[email protected]
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>_______________________________________________
>Delphi mailing list
>[email protected]
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi