R
Robin Tucker
Can someone tell me if my IShellFolder interface is correct please? I've
been having problems with BindToObject. Do I need to marshal the interface
"ppv" out somehow? I can't for the life of me see what the problem is but I
keep getting Null Reference Exceptions when I attempt to use it, although I
can get an IEnumIDList from it for enumerating child pidls no problem at
all!
' /////////////////////////////////////////////////////////////////////////
' // IShellFolder
' /////////////////////////////////////////////////////////////////////////
<ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("000214E6-0000-0000-C000-000000000046")> _
Public Interface IShellFolder
<PreserveSig()> _
Function ParseDisplayName(ByVal hwnd As IntPtr, ByVal pbc As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszDisplayName As [String], ByRef
pchEaten As UInt32, ByRef ppidl As IntPtr, ByRef pdwAttributes As
UInt32) As Int32
<PreserveSig()> _
Function EnumObjects(ByVal hwnd As IntPtr, ByVal grfFlags As
ShellAPI.SHCONTF, ByRef ppenumIDList As IntPtr) As Int32
<PreserveSig()> _
Function BindToObject(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByVal
riid As Guid, ByRef ppv As IShellFolder) As Integer
<PreserveSig()> _
Function BindToStorage(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByVal
riid As Guid, ByRef ppv As IntPtr) As Int32
<PreserveSig()> _
Function CompareIDs(ByVal lParam As Int32, ByVal pidl1 As IntPtr, ByVal
pidl2 As IntPtr) As Int32
<PreserveSig()> _
Function CreateViewObject(ByVal hwndOwner As IntPtr, ByVal riid As Guid,
ByRef ppv As IntPtr) As Int32
<PreserveSig()> _
Function GetAttributesOf(ByVal cidl As UInt32,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=0)> ByVal apidl() As
IntPtr, ByRef rgfInOut As UInt32) As Int32
<PreserveSig()> _
Function GetUIObjectOf(ByVal hwndOwner As IntPtr, ByVal cidl As UInt32,
ByVal apidl() As IntPtr, ByVal riid As Guid, ByRef rgfReserved As UInt32,
ByRef ppv As IntPtr) As Int32
<PreserveSig()> _
Function GetDisplayNameOf(ByVal pidl As IntPtr, ByVal uFlags As Integer,
ByRef pName As ShellAPI.STRRET) As Int32
<PreserveSig()> _
Function SetNameOf(ByVal hwnd As IntPtr, ByVal pidl As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As [String], ByVal uFlags As
UInt32, ByRef ppidlOut As IntPtr) As Int32
End Interface
been having problems with BindToObject. Do I need to marshal the interface
"ppv" out somehow? I can't for the life of me see what the problem is but I
keep getting Null Reference Exceptions when I attempt to use it, although I
can get an IEnumIDList from it for enumerating child pidls no problem at
all!
' /////////////////////////////////////////////////////////////////////////
' // IShellFolder
' /////////////////////////////////////////////////////////////////////////
<ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("000214E6-0000-0000-C000-000000000046")> _
Public Interface IShellFolder
<PreserveSig()> _
Function ParseDisplayName(ByVal hwnd As IntPtr, ByVal pbc As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszDisplayName As [String], ByRef
pchEaten As UInt32, ByRef ppidl As IntPtr, ByRef pdwAttributes As
UInt32) As Int32
<PreserveSig()> _
Function EnumObjects(ByVal hwnd As IntPtr, ByVal grfFlags As
ShellAPI.SHCONTF, ByRef ppenumIDList As IntPtr) As Int32
<PreserveSig()> _
Function BindToObject(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByVal
riid As Guid, ByRef ppv As IShellFolder) As Integer
<PreserveSig()> _
Function BindToStorage(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByVal
riid As Guid, ByRef ppv As IntPtr) As Int32
<PreserveSig()> _
Function CompareIDs(ByVal lParam As Int32, ByVal pidl1 As IntPtr, ByVal
pidl2 As IntPtr) As Int32
<PreserveSig()> _
Function CreateViewObject(ByVal hwndOwner As IntPtr, ByVal riid As Guid,
ByRef ppv As IntPtr) As Int32
<PreserveSig()> _
Function GetAttributesOf(ByVal cidl As UInt32,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=0)> ByVal apidl() As
IntPtr, ByRef rgfInOut As UInt32) As Int32
<PreserveSig()> _
Function GetUIObjectOf(ByVal hwndOwner As IntPtr, ByVal cidl As UInt32,
ByVal apidl() As IntPtr, ByVal riid As Guid, ByRef rgfReserved As UInt32,
ByRef ppv As IntPtr) As Int32
<PreserveSig()> _
Function GetDisplayNameOf(ByVal pidl As IntPtr, ByVal uFlags As Integer,
ByRef pName As ShellAPI.STRRET) As Int32
<PreserveSig()> _
Function SetNameOf(ByVal hwnd As IntPtr, ByVal pidl As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As [String], ByVal uFlags As
UInt32, ByRef ppidlOut As IntPtr) As Int32
End Interface