{==============================================================================}
function WinPath(lc_path : string) : string;
{------------------------------------------------------------------------------}
{ Return the Windows directory as a string
{ Requires WINPROCS in the USES section
{          SYNTAX:
{            gc_WinPath := WinPath(gc_WinPath);
{==============================================================================}
var
  lc_char : Char;
  lc_MsgText : string;
  lc_pointer : PChar;
  lc_pos : Integer;
  lc_size : Word;
begin
  lc_path := '';
     {Get an area in memory}
  try
    GetMem(lc_pointer, 200);
  except
    begin
      lc_MsgText := 'Not enough memory in the heap'+Chr(10);
      lc_MsgText := lc_MsgText + 'Closing the application';
      MessageDlg(lc_MsgText , mtWarning, [mbOk], 0 );
      Halt;
    end;
  end;
     {Get the windows directory and size of the "string"}
  lc_size := GetWindowsDirectory(lc_pointer, 200);
     {Convert the directory to a string}
  for lc_pos := 0 to lc_size-1 do
    begin
      lc_char := lc_pointer[lc_pos];
      lc_path := lc_path + lc_Char;
    end;
      {If the path doesn't end with "\", add it}
  if copy(lc_path, Length(lc_path),1)<>'\' then lc_path := lc_path + '\';
      {Free the memory taken for this operation}
  Dispose(lc_pointer);
  WinPath := lc_path;
end;



