Private Sub Command1_Click()
Dim spath As String
Dim a As Long
spath = Space(256)
a = GetSystemDirectory(spath, 256) 'a为返回系统路径长度
spath = Left(spath, a)
spath = spath & "\yb.ini"
Text1.Text = spath
End Sub
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long