All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
delphi获取Windows目录

Writer: aaa Article type: Programming skills(编程技巧) Time: 2014/7/19 0:13:13 Browse times: 362 Comment times: 0

delphi获取Windows目录


Head photo

Go homepage
Upload pictures
Write articles

delphi获取Windows目录|GetSystemDirectory函数

获取Windows 目录
要获取Windows 目录的位置可以调用Win32 的GetWindowsDirectory() 。该函数类似于GetSystemDirectory(),其返回值的含义也与GetSystemDirectory()相同。该函数的用法如下:
procedure TForm1.Button1Click(Sender: TObject);
var
MyWinPath:String;
begin
SetLength(MyWinPath,144);
if GetWindowsDirectory(PChar(MyWinPath),144)<>0 then
begin
SetLength(MyWinPath,Length(PChar(MyWinPath)));
Edit1.Text:=MyWinPath;
end
else
RaiseLastWin32Error;
end;
如果函数调用成功,GetWindowsDirectory()返回目录路径的长度(整数值),否则返回0,表明有错误产生。这时可以调用RaiseLastWin32Error()来分析产生错误的原因。





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.