新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Sub Command1_Click()
Dim a As String * 256
GetTempPath 256, a
MsgBox Left(a, InStr(a, Chr(0)) - 1)
End Sub