Einzelnen Beitrag anzeigen

Frank2269
(Gast)

n/a Beiträge
 
#1

Wie finde ich die Windows Systempfade z.B : C:\Windows\temp

  Alt 20. Aug 2003, 14:27
Wie finde ich die Windowssystemordner z.B:

TEMP
SYSTEM, SYSTEM32 ,Installationspfad \Windows oder \WINNT.

Mit foglenden Functionen geht das.

1.) Windows Temp auslesen

Uses Windows.pas "Normalerweise automatisch eingebunden"
Delphi-Quellcode:
Function TempPath:String;
var
  buf:Pointer;
begin
  GetMem(buf,MAX_PATH);
  GetTempPathA(MAX_PATH,buf);
  TempPath:=strpas(buf);
  FreeMem(buf,MAX_PATH);
end;
2.) Installationsordner von Windows

Uses Windowspas "Normalerweise automatisch eingebunden"
Delphi-Quellcode:
Function WinDowsDir:String;
var
  a : Array[0..MAX_PATH] of char;
  Temp:String;
begin
  GetWindowsDirectory(a, sizeof(a));

  Temp:=(StrPas(a));
  Temp:=copy(temp,length(temp),1); /// Abschließenden Slash anfügen !

   if Temp='\then
     WinDowsDir:=((trim(StrPas(a))))
   else
     WinDowsDir:=((trim(StrPas(a))))+'\';
end;
3.) Der Windows Systemordner
Delphi-Quellcode:
Function SysDir:String;
var
  a : Array[0..MAX_PATH] of char;
  Temp:String;
begin
  GetSystemDirectory(a, sizeof(a));

  Temp:=(StrPas(a));
  Temp:=copy(temp,length(temp),1); /// Abschließenden Slash anfügen !

  if Temp='\then
    GetSysDir:=((trim(StrPas(a))))
  else
    GetSysDir:=((trim(StrPas(a))))+'\';
end;
Gruß Frank

[edit=Luckie] Mfg, Luckie[/edit]
[edit=Matze]Code formatiert. Mfg, Matze[/edit]
  Mit Zitat antworten Zitat