Get the Window's directory  

Send By: Q3 Team
Web : http://www.q3.nu
Email: dlib@q3.nu
Date: 15/07/99

Tip accessed 582 times

 


Put a TLabel (Label1) and put this code into OnCLick event of a button:


 procedure TForm1.Button5Click(Sender: TObject);
   function GetWindowsDirectory : String;
   var
      pcWindowsDirectory : PChar;
      dwWDSize           : DWORD;
   begin
      dwWDSize := MAX_PATH + 1;
      GetMem( pcWindowsDirectory, dwWDSize );
      try
         if Windows.GetWindowsDirectory( pcWindowsDirectory, dwWDSize ) <> 0 then
            Result := pcWindowsDirectory;
      finally
         FreeMem( pcWindowsDirectory );
      end;
   end;
 begin
    Label1.Caption:=GetWindowsDirectory;
 end;