How to create a "Shell IDList Array" to support drag-and-drop of virtual files from C# to Windows Ex

Posted by JustABill on Stack Overflow See other posts from Stack Overflow or by JustABill
Published on 2010-05-29T22:56:47Z Indexed on 2010/05/29 23:02 UTC
Read the original article Hit count: 259

Filed under:
|
|
|
|

I started trying to implement drag-and-drop of virtual files (from a C# 4/WPF app) with this codeplex tutorial. After spending some time trying to figure out a DV_E_FORMATETC error, I figured out I need to support the "Shell IDList Array" data format. But there seems to be next to zero documentation on what this format actually does.

After some searching, I found this page on advanced data transfer which said that a Shell IDList Array was a pointer to a CIDA structure. This CIDA structure then contains the number of PIDLs, and a list of offsets to them. So what the hell is a PIDL? After some more searching, this page sort of implies it's a pointer to an ITEMIDLIST, which itself contains a single member that is a list of SHITEMIDs.

My next idea was to try dragging a file from another application with virtual files. I just got a MemoryStream back for this format. At least I know what class to provide for the thing, but that doesn't help at all for explaining what to put in it.

So now that that's explained, I still have no idea how to create one of these things so that it's valid. There's two real questions here:

  1. What is a valid "abID" member for a SHITEMID? These virtual files only exist with my program; will the thing they are dragged to pass the "abID" back later when it executes GetData? Do they have to be system-unique?
  2. Why are there two levels of lists; a list of PIDLs and each PIDL has a list of SHITEMIDs? I'm assuming one of them is one for each file, but what's the other one for? Multiple IDs for the same file?

Any help or even links that explain what I should be doing would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf