Attribute VB_Name = "WindowsOrdner"

Public Const MAX_PATH As Long = 260

'Windows-Verzeichnisse
Private Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long

Private Declare Function GetSystemDirectory Lib "kernel32" _
Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long

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

Private Declare Function GetTempFileName Lib "kernel32" _
Alias "GetTempFileNameA" (ByVal lpszPath As String, _
ByVal lpPrefixString As String, ByVal wUnique As Long, _
ByVal lpTempFileName As String) As Long

Public Function WinDir() As String
   Dim sDirBuf As String * 255
   StrLen = GetWindowsDirectory(sDirBuf, 255)
   WinDir = Left$(sDirBuf, StrLen)
End Function

Public Function SysDir() As String
   Dim sDirBuf As String * 255
   StrLen = GetSystemDirectory(sDirBuf, 255)
   SysDir = Left$(sDirBuf, StrLen)
End Function

Public Function TempDir() As String
   Dim sDirBuf As String * 255
   StrLen = GetTempPath(255, sDirBuf)
   TempDir = Left$(sDirBuf, StrLen)
End Function

Public Function TempFiles() As String
   Dim WinTmpDir, TmpFile As String
   Dim R As Long
   
   TmpFile = Space$(MAX_PATH)
   WinTmpDir = Environ$("temp")
   R = GetTempFileName(WinTmpDir, "", 0, TmpFile)
   'Fehler ? Dann hat r den Wert 0
   If R <> 0 Then
      TempFiles = Left$(TmpFile, InStr(TmpFile, Chr$(0)) - 1)
   End If
End Function




