Tempフォルダの場所を取得する
メモ:TempフォルダはWindowsの起動に必要なので必ず存在します。
Dim Path As String
Path = Environ("TEMP")
MsgBox Path
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAX_PATH As Integer = 260Private Sub Command1_Click() Dim Path As String
Path = TempFolder()
MsgBox Path
End Sub
Private Function TempFolder() As String Dim FolderName As String
FolderName = Space(MAX_PATH)
Call GetTempPath(Len(FolderName), FolderName)
TempFolder = Left(FolderName, InStr(1, FolderName, vbNullChar) - 1)End Function
VB.NET2002以降では「Tempフォルダの場所を取得する」を参照