Get system temp directory : Window Installation « Windows API « VBA / Excel / Access / Word






Get system temp directory

 
Type MEMORYSTATUS
   dwLength As Long
   dwMemoryLoad As Long
   dwTotalPhys As Long
   dwAvailPhys As Long
   dwTotalPageFile As Long
   dwAvailPageFile As Long
   dwTotalVirtual As Long
   dwAvailVirtual As Long
End Type

Type SYSTEM_INFO
   dwOemID As Long
   dwPageSize As Long
   lpMinimumApplicationAddress As Long
   lpMaximumApplicationAddress As Long
   dwActiveProcessorMask As Long
   dwNumberOrfProcessors As Long
   dwProcessorType As Long
   dwAllocationGranularity As Long
   dwReserved As Long
End Type
Declare Function abGetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

Public Const MAX_PATH = 160
Sub GetSysInfo()
    Dim intMousePresent As Integer
    Dim strBuffer As String
    Dim intLen As Integer
    Dim MS As MEMORYSTATUS
    Dim SI As SYSTEM_INFO


    strBuffer = Space(MAX_PATH)
    intLen = abGetTempPath(MAX_PATH, strBuffer)
    Debug.Print "TempDir" & Left(strBuffer, intLen)


End Sub

 








Related examples in the same category

1.Get Window Installation Path
2.Get Windows System Path
3.Get temp folder file path