CodeItBetter Programming Another VB Programming Blog

How to get unique Temp File Name

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'System & API - How to get unique Temp File Name
Option Explicit
 
Private Declare Function GetTempFileNameA Lib "kernel32" (ByVal lpszPath As String, _
    ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
 
Public Function GetTempFileName() As String
    Dim s As String, s2 As String
    s2 = GetTempPath
    s = Space(Len(s2) + MAX_FILENAME_LEN)
    Call GetTempFileNameA(s2, App.EXEName, UNIQUE_NAME, s)
    GetTempFileName = Left$(s, InStr(s, Chr$(0)) - 1)
End Function

Related posts:

  1. How to Create a temporary file
  2. How to get Temp Path
  3. How to Return Volume Name for given Drive letter
  4. How to Get windows temp path
  5. How to find the associated program for a file
  6. How to Return a volume’s serial number
  7. How to show File Open dialog without using Common Dialog Control
  8. How to get System Directory
  9. How to Return the file portion of a file + pathname without extension (in two ways)
  10. How to Get file extension for a given file (in two ways)

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.