DWORD GetTempPath(
  DWORD nBufferLength,  // size, in characters, of the buffer
  LPTSTR lpBuffer       // pointer to buffer for temp. path
);
 
调用成功后 lpBuffer 中即是临时目录的路径,如 "c:\win98\temp"
在其中建立文件就不用说了吧

解决方案 »

  1.   

    1。用SCUM的方法找到TEMP PATH。
    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
      

  2.   

    用gettemppath APIprivate declare function GetTempPath lib "kerbek32" _
       alias "GetTempPathA" ( byval nBufferLength as long, _
       byval lpBuffer as string ) as long
      

  3.   

    Sorry ,kerbek32 应是kernel32