Clstmp


Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (Byval
lpszPath As String, Byval lpPrefixString As String, Byval wUnique As Long,
Byval TempFileName As String) As Long
Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (Byval
nBufferLength As Long, Byval lpBuffer As String) As Long
Declare Function GetSystemDirectory Lib "Kernel32" Alias "GetSystemDirectoryA"
(Byval lpBuffer As String, Byval nSize As Long) As Long
'



'===============================================================================
===========
' C L A S S "TmpFile"
'===============================================================================
===========
Class TmpFile

Declare Public Function GetSysDir()As String
Declare Public Function TempPath() As String
Declare Public Function IsDriveAvailable(drivNam$) As Variant
Declare Private Function DeleteExtraChars(sSource As String, eChar As String)
As String

Public Function CreateTempFileName(inDir As String) As Variant

On Error Goto ERROR_HANDLE

tName$ = Space$(255)
Prefix$ = "TMP"

inDir = DeleteExtraChars(inDir, "\")

If inDir = "" Then
TMP$ = TempPath()
Else
' inDir must be terminated by an "\"
If Right$(inDir,1) <> "\" Then
inDir = inDir & "\"
End If
' Check if Path exists, else create Path
MakePath(inDir)
End If
TMP$ = inDir
r& = GetTempFileName(TMP$, Prefix$, 0&, tName$)
CreateTempFileName = Left$(tName$, Instr(tName$, Chr$(0)) -1)
Exit Function
ERROR_HANDLE:
CreateTempFileName = "99"
Exit Function
End Function

Public Function TempPath () As String
' Get System Temp Dir
Dim Buffer As String
Buffer = Space$(255)
r& = GetTempPath(Len(Buffer),Buffer)
TempPath = Left$(Buffer, Instr(Buffer, Chr$(0)))

End Function

Public Function GetSysDir()As String
Temp$ = Space(255)
vlen& = GetSystemDirectory(Temp$, Len(Temp$))
Temp$ = Left$(Temp$, vlen&)
GetSysDir = Temp$
End Function


Private Function DeleteExtraChars(sSource As String, eChar As String) As
String

Dim sResult As String
sResult = ""

For i% = 1 To Len(sSource)
If Mid$(sSource,i%,1) = eChar Then
If flag& = 0 Then
sResult = sResult & Mid$(sSource,i%,1)
flag& = 1
End If
Else
sResult = sResult & Mid$(sSource,i%,1)
flag& = 0
DeleteExtraChars = sResult
End If

Next
DeleteExtraChars=sResult
End Function

End Class
This was first published in November 2000

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close