creating temp files 
Author Message
 creating temp files

Hello,
  First I would appreciate any help you may give me.   Does anyone know how
to create a temp file  random or seq.   with a specified extsion  like a
jpg.  but the file names would be in order..like....001.jpg  then 002.jpg..
on and on...

Thanks.
Bill



Thu, 17 Mar 2005 03:02:02 GMT  
 creating temp files


Quote:
>Hello,
>  First I would appreciate any help you may give me.   Does anyone know how
>to create a temp file  random or seq.   with a specified extsion  like a
>jpg.  but the file names would be in order..like....001.jpg  then 002.jpg..
>on and on...

Short of scanning the directory and incrementing the extension,  try
this for random file names  
Mind that the files are created automatically, and it's your job to to
remove them.

Option Explicit

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
Private Declare Function GetTempPath Lib "kernel32" Alias
"GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String)
As Long

Dim tempPath As String

Private Sub Command1_Click()
    Dim s As String
    Dim ret As Long
    s = Space$(260)

    'use %TEMP% for this.
    If tempPath = "" Then
        tempPath = Space$(260)
        ret = GetTempPath(260, tempPath)
        tempPath = Left$(tempPath, ret)
    End If

    ret = GetTempFileName(tempPath, "", 0, s)
    s = UCase$(Left$(s, InStr(s, Chr$(0)) - 1))
    s = Replace(s, ".TMP", ".JPG")
    Debug.Print s
End Sub

--
Regards, Frank



Sun, 20 Mar 2005 17:23:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. My database program is creating temp files on the desktop!?!

2. My app makes a temp file in win/temp dir upon execution

3. MSCOMM...creating a temp file to write data to

4. Timers and Creating Random temp files.

5. Why are TEMP files created in working directory?

6. Temp Files created by VB

7. 0kb temp files created in root

8. How to: temp = Image1, or temp.Picture = Image1.Picture

9. create a folder or find default temp folder

10. How do I Create Temp Tables

11. How to create temp table?

12. How to create a temp database with code?

 

 
Powered by phpBB® Forum Software