VB编程:获取系统目录和Windows目录

文章作者 100test 发表时间 2007:03:26 17:25:27
来源 100Test.Com百考试题网


计算机等级考试训练软件《百宝箱》

当我们需要让自己的程序判断系统目录和windows目录的名字。这时可以调用windowsapi函数getsystemdirectory和getwindowsdirectory。


声明:

获取系统目录
public declare function getsystemdirectory lib kernel32 alias getsystemdirectorya _
(byval lpbuffer as string, byval nsize as long) as long

获取windows目录
declare function getwindowsdirectory lib kernel32 alias getwindowsdirectorya _
(byval lpbuffer as string, byval nsize as long) as long


调用:

检查系统目录
public function getsystempath() as string
dim p as string * 80
dim length as long
dim path as string

length = getsystem directory(p, len(p))
path = left(p, length)
getsystempath = path
end function

检查windows目录
public function getwindowspath() as string
dim p as string * 80
dim length as long
dim path as string

length = getwindows directory(p, len(p))
path = left(p, length)

getwindowspath = path
end function



相关文章


2004年全国计算机等级考试二级VB全真上机试题解析
2003年9月全国计算机等级考试二级VB语言笔试试卷(含参考答案)
2003年4月全国计算机等级考试二级visualBasic笔试试卷(含答案)
2002年9月全国计算机等级考试二级VB试卷(含答案)
VB编程:获取系统目录和Windows目录
全国计算机等级考试二级:如何编写高质量的VB代码
VB编程:去掉窗体的关闭按钮
VB中利用Winrar进行文件压缩
VB编程:如何在列表框中自动查找
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛