获得Temp目录:
Declare Function GetTempPath Lib "KERNEL32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Function GetWindowTempPath() As String
Dim Dummy As Long, StrLen As Long, TempPath As String
StrLen = 255
TempPath = String$(StrLen, 0)
Dummy = GetTempPath(StrLen, TempPath)
If Dummy Then
GetWindowTempPath = Left$(TempPath, Dummy)
Else
GetWindowTempPath = ""
End If
End Function
获得Windows目录:
Declare Function GetWindowsDirectory Lib "KERNEL32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Function GetWindowsPath() As String
Dim Dummy As Long, StrLen As Long, TempPath As String
StrLen = 255
TempPath = String$(StrLen, 0)
Dummy = GetWindowsDirectory(TempPath, StrLen)
If Dummy Then
GetWindowsPath = Left$(TempPath, Dummy)
Else
GetWindowsPath = ""
End If
End Function
当然,你还可以用iShellLinkA获得所有有关Windows的路径和目录。
To lysccd: 他是VB高手吗???
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。