Declare Function GetTempPath Lib "kernel32.dll" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
GetTempPath reads Windows's default Temp directory. The Temp directory is where temporary files made and used by Windows-based programs should be put. Usually this will be the \Temp subdirectory under the Windows directory, but not necessarily. The path of the directory is put into the string variable passed as lpBuffer. The function returns the length of the string, or 0 if it fails.
Example:
' Display the Temp directory
Dim tempdir As String * 255
x = GetTempPath(255, tempdir) ' get the directory
Debug.Print "The Temp directory is "; Left(tempdir, x)
Related Call: GetTempFileName
Category: System Information
Back to the index.