Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function请问r = NOERROR中的noerror是个什么常量吗?是自定义还系统本身的
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function请问r = NOERROR中的noerror是个什么常量吗?是自定义还系统本身的
类似
const NOERROR = 1001 那样SHGetSpecialFolderLocation 函数的原型
返回值就是一个长整型的变量Declare Function SHGetSpecialFolderLocation Lib "Shell32 "(ByVal hwndOwne r As Long, ByVal nFolder As Integer, ppidl As Long) As Long
Public Const NOERROR = 0这类问题可参阅VB自带的API文本浏览器。