Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
/// <summary>
/// The GetTempFileName and GetTempFolderName methods (and overloads) provide
/// the same level of convenience as the managed Path.GetTempFileName (including
/// support for folders), but provide access to the Win32 functionality of providing
/// an optional prefix, unique suffix and base folder name, as well as the Win32
/// functionality of creating the temp file or folder as soon as the name is generated.
/// </summary>
class Win32Utility {
[DllImport("kernel32.dll", SetLastError = true)]
static extern uint GetTempFileName(string lpPathName, string lpPrefixString, uint uUnique, [Out] StringBuilder lpTempFileName);
public static string GetTempFileName() {
return GetTempFileName("tmp");
}
public static string GetTempFileName(string prefix) {
return GetTempFileName(prefix, 0);
}
[Visual Basic]
Public Shared Function GetTempFileName() As String
[C#]
public static string GetTempFileName();
[C++]
public: static String* GetTempFileName();
[JScript]
public static function GetTempFileName() : String;
Credits
Tips & Tricks: Chris Sells (csells@sellsbrothers.com)
Sample Code: Chris Sells (csells@sellsbrothers.com)
The GetTempFileName API
3/16/2007 7:55:45 AM - -198.70.207.254
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).