vb如何得到系统路径?

xzjxu 2010-08-21 05:41:28
比如:c:\windows
...全文
77 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
threenewbee 2010-08-21
  • 打赏
  • 举报
回复
GetSystemDirectory() API
或者
FSO里面的GetSpecialFolder,参考 http://msdn.microsoft.com/en-us/library/a72y2t1c(VS.85).aspx
lsh6688 2010-08-21
  • 打赏
  • 举报
回复
直接app.path就是当前路径啊
fzx4936 2010-08-21
  • 打赏
  • 举报
回复
Private 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 Sub Command1_Click()
Dim SystemPath As String * 1000, WindowPath As String * 1000
Call GetSystemDirectory(SystemPath, 1000)
SystemPath = Left$(SystemPath, InStr(SystemPath, Chr$(0))) '一般得到C:\WINDOWS\System32
Call GetWindowsDirectory(WindowPath, 1000)
WindowPath = Left$(WindowPath, InStr(WindowPath, Chr$(0))) '一般得到C:\WINDOWS
End Sub
fzx4936 2010-08-21
  • 打赏
  • 举报
回复
Environ("windir")

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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