Главная страница | назад





Article #17563: Getting the windows directory.

 Question and Answer Database

FAQ2563D.txt   Getting the windows directory.
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How can I determine where the Windows directory is?


Answer:
You can make a call to the Windows API function
GetWindowsDirectory().

If you want the system directory, simply call the Windows API function
GetSystemDirectory().

Example:

{$IFNDEF WIN32}
 const MAX_PATH = 144;
{$ENDIF}

procedure TForm1.Button1Click(Sender: TObject);
var
  a : Array[0..MAX_PATH] of char;
begin
  GetWindowsDirectory(a, sizeof(a));
  ShowMessage(StrPas(a));
  GetSystemDirectory(a, sizeof(a));
  ShowMessage(StrPas(a));
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99