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ワンポイントテクニック目次に戻る

楽天モバイル[UNLIMITが今なら1円] ECナビでポインと Yahoo 楽天 LINEがデータ消費ゼロで月額500円〜!


無料ホームページ 無料のクレジットカード 海外格安航空券 解約手数料0円【あしたでんき】 海外旅行保険が無料! 海外ホテル