如何獲取系統的臨時目錄路徑?

2021-04-17 00:37:32 字數 980 閱讀 2856

gettemppath取得的是乙個dos名稱,當檔名長度大於8時,長檔名格式「c:documents and settingsadministratorlocal settingstemp」會顯示成「c:docume~1admini~1locals~1temp」的短檔名格式,如何根據自己需要取得系統臨時目錄的途徑,下面是乙個新寫的函式,呼叫兩個api 實現,相信許多朋友可能用得到。

option explicitprivate declare function getlongpathname lib "kernel32" alias "getlongpathnamea" (byval lpszshortpath as string, byval lpszlongpath as string, byval cchbuffer as long) as longprivate 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)        dim longname as string, shortname as string        shortname = space(256)    gettemppath len(shortname), shortname     longname = space(1024)    getlongpathname shortname, longname, len(longname)

msgbox "tempfolder : " & iif(showlong = true, longname, shortname)   end sub

private sub command1_click() gettempfolder '長檔名 gettempfolder false '短檔名end sub

如何獲取系統的臨時目錄路徑?

gettemppath取得的是乙個dos名稱,當檔名長度大於8時,長檔名格式 c documents and settings administrator local settings temp 會顯示成 c docume 1 admini 1 locals 1 temp 的短檔名格式,如何根據自己...

如何獲取系統的臨時目錄路徑?

gettemppath取得的是乙個dos名稱,當檔名長度大於8時,長檔名格式 c documents and settings administrator local settings temp 會顯示成 c docume 1 admini 1 locals 1 temp 的短檔名格式,如何根據自己...

如何獲取系統的臨時目錄路徑?

gettemppath取得的是乙個dos名稱,當檔名長度大於8時,長檔名格式 c documents and settings administrator local settings temp 會顯示成 c docume 1 admini 1 locals 1 temp 的短檔名格式,如何根據自己...