GetTempPath Function

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.

nBufferLength
The length in characters of lpBuffer
lpBuffer
A fixed-length string that will receive the path of the Temp directory.

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.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/gettemppath.html