Something wrong with my Piddle? (IShellFolder madness!)

R

Robin Tucker

I've got this nice pidl, enumerated via. IEnumIDList on an IShellFolder (the
desktop). I know the pidl is ok, because I can list its display name and
its looking good. Now I want to go a level down using this piddle and the
BindToObject method on the IShellFolder interface. Here's what I'm doing:

This is how I declare the method on my IShellFolder interface.

<PreserveSig()> _
Function BindToObject(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByVal riid
As Guid, ByRef ppv As IntPtr) As Int32

This is how I execute the method with my piddle (theFolder is an
IShellFolder, previously verified as being ok - I'm using it to enumerate
its children as pidls):

Dim ptrRet As IntPtr
theFolder.BindToObject(pIDL, IntPtr.Zero,
ShellLib.ShellGUIDs.IID_IShellFolder, ptrRet)

I know my piddle is ok, because I used it to get the display name for the
object it refers to. But I can't get an IShellFolder from this piddle. I
get an null reference exception when I try to execute the above method.
 
M

Mattias Sjögren

Robin,
<PreserveSig()> _
Function BindToObject(ByVal pidl As IntPtr, ByVal pbc As IntPtr, ByVal riid
As Guid, ByRef ppv As IntPtr) As Int32

riid should be passed ByRef or marked with
<MarshalAs(UnmanagedType.LPStruct)>




Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top