gettemppath取得的是一個(gè)dos名稱,當(dāng)文件名長(zhǎng)度大于8時(shí),長(zhǎng)文件名格式“c:/documents and settings/administrator/local settings/temp”會(huì)顯示成“c:/docume~1/admini~1/locals~1/temp”的短文件名格式,如何根據(jù)自己需要取得系統(tǒng)臨時(shí)目錄的途徑,下面是一個(gè)新寫的函數(shù),調(diào)用兩個(gè)api 實(shí)現(xiàn),相信許多朋友可能用得到。
option explicit private declare function getlongpathname lib "kernel32" alias "getlongpathnamea" (byval lpszshortpath as string, byval lpszlongpath as string, byval cchbuffer as long) as long private declare function gettemppath lib "kernel32" alias "gettemppatha" (byval nbufferlength as long, byval lpbuffer as string) as long
sub gettempfolder(optional byval showlong as boolean = true)