Tempディレクトリを取得

<一時ファイルが作成可能に>

宣 言

(Private) Declare Function GetTempPath Lib "KERNEL32" Alias "GetTempPathA" (ByVal nBufferLength&, ByVal lpBuffer$) As Long

※Privateは必要に応じて削除またはPublicに変更


引 数 説 明


Size

Long

TempDirのサイズ

TempDir

String

Tempディレクトリを格納する文字列


<注意>
GetSystemDirectoryやGetWindowsDirectoryとは引数が逆になっていることに注意してください。
またTempDirにはNull文字列が含まれます。何らかの方法で消去してください。

サ ン プ ル プ ロ グ ラ ム

Private Declare Function GetTempPath Lib "KERNEL32" Alias "GetTempPathA" (ByVal nBufferLength&, ByVal lpBuffer$) As Long
Private Sub Form_Load()
Dim TempDir As String * 255
GetTempPath 255, TempDir
MsgBox TempDir
End
End Sub

トップに戻る
Visual Basicワンポイントテクニック目次に戻る

Gポイントポイ活 Amazon Yahoo 楽天

無料ホームページ 楽天モバイル[UNLIMITが今なら1円] 海外格安航空券 海外旅行保険が無料!