如何取windows的system路径

lorentz 2002-10-28 11:17:25
如题!
...全文
23 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ly_liuyang 2002-10-28
  • 打赏
  • 举报
回复
function GetSysDir:string;
var dirsys:pchar;
begin
dirsys:=stralloc(1024);
getsystemdirectory(dirsys,1024);
result:=dirsys;
strdispose(dirsys);
end;
sanjianxia 2002-10-28
  • 打赏
  • 举报
回复
对呀!采用两年API函数就可以完成了。
首先:在uses中加shellapi
//sysDir是windows路径
GetWindowsDirectory(sysDir,255);
//SysDir是Windows/system路径如果是nt,者是
GetSystemDirectory(SysDir,255); winnt/System32
zzg40280614 2002-10-28
  • 打赏
  • 举报
回复
1、GetSystemDirectory='c:\winnt\system'
2、GetwindowsDirectory='c:\winnt'
killer2008 2002-10-28
  • 打赏
  • 举报
回复
var
SysDir:array[0..255] of char
begin
GetWindowsDirectory(sysDir,255); //sysDir是windows路径
GetSystemDirectory(SysDir,255); //SysDir是Windows/system路径如果是nt,者是winnt/System32

end;

用第2 个函数就可以了,记住在uses中加shellapi
xzhifei 2002-10-28
  • 打赏
  • 举报
回复
var
WinDir:PChar;
begin
GetWindowsDirectory(WinDir,255);
Application.MessageBox(WinDir,Pchar(Caption),0);
Sumie@Sam 2002-10-28
  • 打赏
  • 举报
回复
var
SysDir: array [0..255] of char;
begin
GetSystemDirectory(SysDir,255);
end;
//SysDir就是当前Windows的System路径
axcyy 2002-10-28
  • 打赏
  • 举报
回复
var SysDir: array [0..255] of char;
begin
GetSystemDirectory(SysDir,255);
showmessage(sysdir);//显示系统目录
end;
hfycl 2002-10-28
  • 打赏
  • 举报
回复
GetWindowsDirectory

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧