procedure TForm1.Button1Click(Sender: TObject);
var
WinDir: array[0..MAX_PATH] of char; // holds the Windows directory
begin
{retrieve the Windows directory...}
GetWindowsDirectory(WinDir, MAX_PATH);
procedure TForm1.Button1Click(Sender: TObject);
var
SysDir: array[0..MAX_PATH] of Char; // holds the system directory
begin
{retrieve the system directory and display it}
GetSystemDirectory(SysDir, MAX_PATH);
Label1.Caption := StrPas(SysDir)
end;
The GetWindowsDirectory function retrieves the path of the Windows directory. The Windows directory contains such files as applications, initialization files, and help files.
UINT GetWindowsDirectory(
LPTSTR lpBuffer, // buffer for Windows directory
UINT uSize // size of directory buffer
);
var s1,s2,s3:array[1..40] of char;z1,z2:string;
begin
getwindowsdirectory(@s1,40);
getsystemdirectory(@s2,40);
z1:=trim(s1);
z2:=trim(s2);
showmessage(z1);
showmessage(z2);