Mega Code Archive

 
Categories / Delphi / Strings
 

Expand environment strings

Title: Expand environment strings If you have some environment variable (for example, '%WinDir%'), then you may use ExpandEnvironmentStrings function to get a real value of this variable. procedure TForm1.Button1Click(Sender: TObject); var Str: array [0..255] of Char; begin if ExpandEnvironmentStrings(PChar(Edit1.Text), Str, 256)&gt0 then Label1.Caption:=Str; end;