Comment retrouver le dossier temporaire de Windows ?
L'API SHGetSpecialfolderPath (cfr. Question
60) ne permettant pas de retrouver le chemin du dossier temporaire, il faut
employer l'API GetTempPath :
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA"
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Const MAX_PATH=260
Public Function GetTemporyFolderPath() As String
Dim sBuffer As String
Dim RV As Long
sBuffer= String(MAX_PATH, Chr(0))
RV = GetTempPath(MAX_PATH, sBuffer)
GetTemporyFolderPath= Left(sBuffer, RV)
End Function |