
Temporary Filenames using Windows API Calls
Quote:
> Could someone tell me how to make a temporary file like Windows does in the
> TEMP directory. I found an API call "GetTempFileName", I can't seem to get
> it to work though. It creates the "temp" file in the /windows/temp directory
> but I can't seem to get the filename that was assigned by the
> "GetTempFilename" function. Any help would be appresiated greatly!
It should work. Have you declared the function right? (You can
find it in the Win31api.hlp file
Declare Function GetTempFileName Lib "Kernel" \
(ByVal Drive As Integer, ByVal Prefix As String, ByVal Uniq As Integer, \
ByVal TempFileName As String) As Integer
Arguments are:
Drive The Drive to put the temporary file on. If 0 Windows
will use the TEMP variable.
Prefix Set it to a string you would like to use as a prefix
(1-3 chars and NUL terminated)
Uniq If 0 instructs Windows to ensure a uniq name, otherwise
Windows will use the value of Uniq as the number.
TempFileName Name of file created
Remember to create the space for TempFileName before the call,
e g TempFileName = string$(255) and to NUL terminate the prefix
if you are using it.
Hope this will help!
/Fredrik