DWORD GetTempPath(
DWORD nBufferLength, // size, in characters, of the buffer
LPTSTR lpBuffer // pointer to buffer for temp. path
);
调用成功后 lpBuffer 中即是临时目录的路径,如 "c:\win98\temp"
在其中建立文件就不用说了吧
DWORD nBufferLength, // size, in characters, of the buffer
LPTSTR lpBuffer // pointer to buffer for temp. path
);
调用成功后 lpBuffer 中即是临时目录的路径,如 "c:\win98\temp"
在其中建立文件就不用说了吧
2。用GetTempFileName得到临时文件
EG:
lPath = GetTempPath(MAX_PATH, strOutPath)
If lPath = 0 Then
MsgBox "Error getting temporary file path."
Exit Function
Else
strOutPath = Left(strOutPath, lPath)
End If
strOutFile = Space(MAX_PATH)
If GetTempFileName(strOutPath, "tmp", 0, strOutFile) = 0 Then
MsgBox "Error getting temporary file name."
Exit Function
End If
alias "GetTempPathA" ( byval nBufferLength as long, _
byval lpBuffer as string ) as long