GetWindowsDirectory 获得Windows的安装目录; 具体用法:var Buffer:Pchar; begin Getmem(buffer,256);//为buffer分配256字节空间; GetWindowsDirectory(buffer,256);//取得Windows安装目录,存入Buffer缓冲区; ShowMessage('Windows安装目录为:'+Buffer); end;
或者 从系统变量中获取..DWORD GetEnvironmentVariable( LPCTSTR lpName, // address of environment variable name LPTSTR lpBuffer, // address of buffer for variable value DWORD nSize // size of buffer, in characters );
获得Windows的安装目录;
具体用法:var
Buffer:Pchar;
begin
Getmem(buffer,256);//为buffer分配256字节空间;
GetWindowsDirectory(buffer,256);//取得Windows安装目录,存入Buffer缓冲区;
ShowMessage('Windows安装目录为:'+Buffer);
end;
LPCTSTR lpName, // address of environment variable name
LPTSTR lpBuffer, // address of buffer for variable value
DWORD nSize // size of buffer, in characters
);