Как найти каталог Windows

Previous  Top  Next

    
 

 

Code:

function GetWindowsFolder:string;

{©Drkb v.3(2007): www.drkb.ru,

®Vit (Vitaly Nevzorov) - nevzorov@yahoo.com}

 

var p:PChar;

begin

GetMem(p, MAX_PATH);

result:='';

if GetWindowsDirectory(p, MAX_PATH)>0 then

   result:=string(p);

FreeMem(p);

end;

©Drkb::01659

Àâòîð: Vit (www.delphist.com, www.drkb.ru, www.unihighlighter.com, www.nevzorov.org)

 

 


 

Code:

public

{ Public declarations }

Windir: string;

WindirP: PChar;

Res: Cardinal;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

WinDirP := StrAlloc(MAX_PATH);

Res := GetWindowsDirectory(WinDirP, MAX_PATH);

if Res > 0 then

   WinDir := StrPas(WinDirP);

Label1.Caption := WinDir;

end;

 

©Drkb::01660

http://delphiworld.narod.ru/

DelphiWorld 6.0