[AccessD] Windows Temporary Directory

Gustav Brock Gustav at cactus.dk
Tue Aug 16 08:02:26 CDT 2011


Hi Dale

Here is a similar function, a bit more straight forward:

<code>
' -------------------------------------------------------------------------
' Declarations for GetTempDirectory.

Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" ( _
  ByVal nBufferLength As Long, _
  ByVal lpBuffer As String) As Long

Public Function GetTempDirectory() As String

' Returns path to temp directory incl. traling backslash:
'   c:\winnt\temp\
' 2002-05-31. Cactus Data ApS, CPH.

  Const clngBufferLen As Long = 255
  Dim lngPath         As Long
  Dim strBuffer       As String * clngBufferLen
  
  ' No special error handling.
  On Error Resume Next

  lngPath = GetTempPath(clngBufferLen, strBuffer)
  If lngPath < 0 Then
    lngPath = 0
  End If
  
  GetTempDirectory = LCase(Left(strBuffer, lngPath))
    
End Function
</code>

/gustav


>>> dkalsow at yahoo.com 16-08-2011 14:39 >>>
OK - thanks,  One question how and is MAX_PATH defined?





More information about the AccessD mailing list