I tried this
:
    Buffer  : array[0..254] of Char;
    BufSize : Integer;
...
  GetEnvironmentVariable ('userprofile', Buffer, BufSize);
  BaseDir    := IncludeTrailingPathDelimiter(string(buffer)) + 'documents';

But when I stepped through, I could see Buffer had all zeroes in it, and so 
BaseDir came up with the string '\documents' which threw an exception.  
Something is still not working.

-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 Sid Gudes
Sent: Wednesday, July 23, 2014 8:38 AM
To: 'Moderated List for the Discussion of Delphi Programming excluding 
Database-related topics'
Subject: RE: Running Delphi on 64-bit machines

IIRC a tDirectoryListBox does not know how to 
resolve %userprofile%.  So you need to get the 
value of userprofile and then add '\documents' after it.  Something like:

    GetEnvironmentVariable ('userprofile', buffer, size);
    BaseDir := IncludeTrailingPathDelimiter(string(buffer)) + 'documents';

Or instead of GetEnvironmentVariable, you can use SHGetSpecialFolderLocation.


At 04:28 PM 7/22/2014, Rich Cooper wrote:
>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

_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to