码迷,mamicode.com
首页 > Windows程序 > 详细

Get temp path via windows API

时间:2014-08-07 18:35:21      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:os   io   for   ar   cti   size   window   ef   

Private Const MAX_PATH As Long = 260
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nSize As Long, ByVal lpBuffer As String) As Long

 

Public Function GetTempDir() As String

    Dim nSize As Long
    Dim buff As String
    buff = Space$(MAX_PATH)
    nSize = Len(buff)
    Call GetTempPath(nSize, buff)
    GetTempDir = TrimNull(buff)
End Function

Private Function TrimNull(item As String)

    Dim pos As Integer
   ‘double check that there is a chr$(0) in the string
    pos = InStr(item, Chr$(0))
    If pos Then
       TrimNull = Left$(item, pos - 1)
    Else
       TrimNull = item
    End If
End Function

 

Private Sub WriteOutput()

    Dim i As Long
    Dim level As Long
    level = 0
    Dim Child As IXMLDOMNode
    ‘output as xml
    Dim tempPath As String
    tempPath = GetTempDir()
    tempPath = tempPath + "test.xml"
    Open tempPath For Output As #1
    Print #1, m_Batch.xml
    Close #1
End Sub

Get temp path via windows API,布布扣,bubuko.com

Get temp path via windows API

标签:os   io   for   ar   cti   size   window   ef   

原文地址:http://www.cnblogs.com/pengpenghappy/p/3897669.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!