Beranda > Delphi > Getting the Windows, System, Temp, & Current Directories

Getting the Windows, System, Temp, & Current Directories

How do you get the Windows, System, Temp, or Current directory? Call GetDirectory() with any one of the DirectoryType.  Example: WindowsSystemDirStr := GetDirectory(_SYSTEM);type
  DirectoryType = (_WINDOWS, _TEMP, _SYSTEM, _CURRENT);

function GetDirectory(Dir: DirectoryType): string;
var
  Path: array [0..260] of Char;
begin
  case Dir of
    _WINDOWS: GetWindowsDirectory(Path, Sizeof(Path));
    _SYSTEM : GetSystemDirectory(Path, Sizeof(Path));
    _TEMP   : GetTempPath(Sizeof(Path), Path);
    _CURRENT: GetCurrentDirectory(Sizeof(Path), Path);
  end;
  Result := StrPas(Path);
end;

Iklan
Kategori:Delphi
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: