如何取得系统目录?如何取得系统目录:例如:system32   winnt
系统临时目录: temp

解决方案 »

  1.   

    path:array [1..255] of char;
    GetSystemDirectory(Path,255);//获得styem32
    GetWindowsDir(Path,255);//winnt
    GetTempPath//temp
      

  2.   

    Function WinDir: String;
    Var
      WinDir: PChar;
    Begin
      GetMem(WinDir, 256);
      GetWindowsDirectory(WinDir, 255);
      Result := IncludeTrailingBackslash(String(WinDir));
      FreeMem(WinDir);
    End;Function TempDir: String;
    Var
      Dir: PChar;
    Begin
      GetMem(Dir, 256);
      GetTempPath(255,Dir);
      Result := IncludeTrailingBackslash(String(Dir));
      FreeMem(Dir);
    End;Function SysDir: String;
    Var
      Dir: PChar;
    Begin
      GetMem(Dir, 256);
      GetSystemDirectory(Dir,255);
      Result := IncludeTrailingBackslash(String(Dir));
      FreeMem(Dir);
    End;