當(dāng)我們需要讓自己的程序判斷系統(tǒng)目錄和windows目錄的名字。這時(shí)可以調(diào)用windowsapi函數(shù)getsystemdirectory和getwindowsdirectory。
聲明:
' 獲取系統(tǒng)目錄
public declare function getsystemdirectory lib 'kernel32' alias 'getsystemdirectorya' _
(byval lpbuffer as string, byval nsize as long) as long
' 獲取windows目錄
declare function getwindowsdirectory lib 'kernel32' alias 'getwindowsdirectorya' _
(byval lpbuffer as string, byval nsize as long) as long
調(diào)用:
' 檢查系統(tǒng)目錄
public function getsystempath() as string
dim p as string * 80
dim length as long
dim path as string
length = getsystem directory(p, len(p))
path = left(p, length)
getsystempath = path
end function
' 檢查windows目錄
public function getwindowspath() as string
dim p as string * 80
dim length as long
dim path as string
length = getwindows directory(p, len(p))
path = left(p, length)
getwindowspath = path
end function
聲明:
' 獲取系統(tǒng)目錄
public declare function getsystemdirectory lib 'kernel32' alias 'getsystemdirectorya' _
(byval lpbuffer as string, byval nsize as long) as long
' 獲取windows目錄
declare function getwindowsdirectory lib 'kernel32' alias 'getwindowsdirectorya' _
(byval lpbuffer as string, byval nsize as long) as long
調(diào)用:
' 檢查系統(tǒng)目錄
public function getsystempath() as string
dim p as string * 80
dim length as long
dim path as string
length = getsystem directory(p, len(p))
path = left(p, length)
getsystempath = path
end function
' 檢查windows目錄
public function getwindowspath() as string
dim p as string * 80
dim length as long
dim path as string
length = getwindows directory(p, len(p))
path = left(p, length)
getwindowspath = path
end function