您的位置:首页 > 编程语言 > VB

用VB获得操作系统路径示例和操作系统环境函数Environ

2006-04-17 22:31 513 查看
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
_______________________________________________________
Private Sub Command1_Click()
        Dim S     As String
        Dim Ret     As Long
        S = Space(1024)
        Ret = GetSystemDirectory(S, 1024)
        S = Left$(S, InStr(S, Chr(0)) - 1)
        MsgBox S
        MsgBox Environ(2)
End Sub

 

操作系统环境函数Environ 就是返回系统set环境变量的值

Private Sub command1_Click()
Dim i As Integer
For i = 1 To 100 
    Debug.Print Environ(i)
Next i
End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vb string command function