昨天有个函数Private Function PathToPidl(sPath As String) As Long
Dim folder As IShellFolder
Dim pidlMain As Long
Dim cParsed As Long
Dim afItem As Long
Dim lFilePos As Long
Dim lR As Long
Dim sRet As String ' Make sure the file name is fully qualified
sRet = String$(MAX_PATH, 0)
lR = GetFullPathName(sPath, MAX_PATH, sRet, lFilePos)
If lR = 0 Then
ApiRaise Err.LastDllError
Else
' debug.Assert c <= cMaxPath
sPath = left$(sRet, lR)
' Convert the path name into a pointer to an item ID list (pidl)
Set folder = GetDesktopFolder
' Will raise an error if path cannpt be found:
If S_OK >= (folder.ParseDisplayName(0&, 0&, StrConv(sPath, vbUnicode),
cParsed, pidlMain, afItem)) Then
PathToPidl = pidlMain
End If
End If
End Function
我加到程序中,IShellFolder和GetDesktopFolder系统不识别,始终有问题,不知道怎么回事?(我引用了Shell32.dll也不行),谢谢了!!
Dim folder As IShellFolder
Dim pidlMain As Long
Dim cParsed As Long
Dim afItem As Long
Dim lFilePos As Long
Dim lR As Long
Dim sRet As String ' Make sure the file name is fully qualified
sRet = String$(MAX_PATH, 0)
lR = GetFullPathName(sPath, MAX_PATH, sRet, lFilePos)
If lR = 0 Then
ApiRaise Err.LastDllError
Else
' debug.Assert c <= cMaxPath
sPath = left$(sRet, lR)
' Convert the path name into a pointer to an item ID list (pidl)
Set folder = GetDesktopFolder
' Will raise an error if path cannpt be found:
If S_OK >= (folder.ParseDisplayName(0&, 0&, StrConv(sPath, vbUnicode),
cParsed, pidlMain, afItem)) Then
PathToPidl = pidlMain
End If
End If
End Function
我加到程序中,IShellFolder和GetDesktopFolder系统不识别,始终有问题,不知道怎么回事?(我引用了Shell32.dll也不行),谢谢了!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货