计算机二级VB:获取系统和Windows目录

文章作者 100test 发表时间 2007:09:11 12:48:54
来源 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



相关文章


美国人打电话时最常用到的一些句子
计算机英语:Windows简介
2007年全国计算机等级考试详解
全国计算机等级考试公共基础知识考试-大纲
计算机二级VB:获取系统和Windows目录
二级VB基础教程:8.3状态栏(Statu ar)和工具栏(ToolBar)
名师解析2008年MBA各科考试-大纲——解疑篇
计算机等级考试报名参考:二级科目综合分析
名师解析2008年MBA各科考试-大纲——英语篇
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛