灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:3750回复:0

VB编写获得Windows目录的代码源码

楼主#
更多 发布于:2012-09-08 11:55

之前写马的时候有用到,现在贴出来给大家看看,希望对大家有用,或者用的时候直接来圣剑之家找吧,呵呵。
模块:
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    
窗体:
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    
  Private iValue     As String
  Private cValue     As String
    
  Public Function GetWinPath() As String
    
          cValue = Space(260)
          iValue = GetWindowsDirectory(cValue, Len(cValue))
          GetWinPath = Left(cValue, iValue)
    
End Function
Private Sub Form_Load()
MsgBox GetWinPath()
End Sub


调用就是GetWinPath() 嘿嘿, 够简单吧


喜欢0 评分0
游客

返回顶部