How To Use GetTempFileName API to Create a Unique Temporary File (195763)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q195763 SUMMARY
For Visual Basic programmers unfamiliar with the Win32 API, making a file
name for a temporary file is often a matter of hard-coding some value and
hoping that the name does not conflict with an existing file. Fortunately,
there is a better way that requires very little code.
This article demonstrates how to use the GetTempPath and GetTempFileName
API functions to construct a unique temporary file name located in the
default temp directory of an end user's system.
REFERENCES
For additional information, please see the following articles in the
Microsoft Knowledge Base:
190000
: How To Get Started Programming With the Windows API (LONG)
137034
: PRB: Win32 GetTempFileName API Differs from 16-bit
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by
Richard R. Taylor, Microsoft Corporation.
Modification Type: | Minor | Last Reviewed: | 8/30/2004 |
---|
Keywords: | kbAPI kbcode kbhowto kbKernBase KB195763 |
---|
|