BOOL GetFullTempFileName(const TCHAR* strPrefix, std::wstring& strFullName) { TCHAR strTempFolder[MAX_PATH]; TCHAR strTempFileName[MAX_PATH]; DWORD dwRetVal = GetTempPath(MAX_PATH, // length of the buffer strTempFolder); // buffer for path if (dwRetVal > MAX_PATH || (dwRetVal == 0)) { return FALSE; } // Generates a temporary file name. UINT uRetVal = GetTempFileName(strTempFolder, // directory for tmp files strPrefix, // temp file name prefix 0, // create unique name strTempFileName); // buffer for name if (uRetVal == 0) { return FALSE; } //返回回去 strFullName = strTempFileName; return TRUE; }