Jason Newell
2006-01-06 15:34:45 UTC
* This post was copied from the
microsoft.public.dotnet.framework.interop forum. Can anyone here help
me? Thanks.
Greetings all,
I'm writing a C# 2.0 Windows application which I'm adding Drag & Drop
support. Very straight forward for the most part but I'm needing some
help dealing with "Shell IDList Array" data. I've done my homework on
researching and this is what I have.
[StructLayout(LayoutKind.Sequential)]
public struct CIDA
{
public uint cidl;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,
SizeConst = 1)]
public uint[] aoffset;
}
protected override void OnDragOver(DragEventArgs drgevent)
{
base.OnDragOver(drgevent);
try
{
MemoryStream data = (MemoryStream)drgevent.Data.GetData("Shell
IDList Array");
byte[] b = data.ToArray();
IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CIDA)));
Marshal.Copy(b, 0, p, b.Length);
CIDA cida = (CIDA)Marshal.PtrToStructure(p, typeof(CIDA));
}
catch (System.Exception e)
{
Console.WriteLine(e.Message);
}
}
Looking at the CIDA structure, I can see in the cidl member correctly
states the number of dragged items. My question is, can someone help me
with the code to emumerate the PIDL's and get the paths to the files
being dragged.
Any help is apprecited. Thanks.
Jason Newell
microsoft.public.dotnet.framework.interop forum. Can anyone here help
me? Thanks.
Greetings all,
I'm writing a C# 2.0 Windows application which I'm adding Drag & Drop
support. Very straight forward for the most part but I'm needing some
help dealing with "Shell IDList Array" data. I've done my homework on
researching and this is what I have.
[StructLayout(LayoutKind.Sequential)]
public struct CIDA
{
public uint cidl;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,
SizeConst = 1)]
public uint[] aoffset;
}
protected override void OnDragOver(DragEventArgs drgevent)
{
base.OnDragOver(drgevent);
try
{
MemoryStream data = (MemoryStream)drgevent.Data.GetData("Shell
IDList Array");
byte[] b = data.ToArray();
IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CIDA)));
Marshal.Copy(b, 0, p, b.Length);
CIDA cida = (CIDA)Marshal.PtrToStructure(p, typeof(CIDA));
}
catch (System.Exception e)
{
Console.WriteLine(e.Message);
}
}
Looking at the CIDA structure, I can see in the cidl member correctly
states the number of dragged items. My question is, can someone help me
with the code to emumerate the PIDL's and get the paths to the files
being dragged.
Any help is apprecited. Thanks.
Jason Newell