VB编程:获取系统目录和Windows目录 |
|
www.nanhushi.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
|
|
|
文章录入:杜斌 责任编辑:杜斌 |
|
上一篇文章: VB编程:去掉窗体的关闭按钮 下一篇文章: 全国计算机等级考试二级:如何编写高质量的VB代码 |
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|