Skip to content

Instantly share code, notes, and snippets.

@ievgiienko
Created November 7, 2023 15:29
Show Gist options
  • Save ievgiienko/85047e4e0fdc503cc0866f8126cc5c25 to your computer and use it in GitHub Desktop.
Save ievgiienko/85047e4e0fdc503cc0866f8126cc5c25 to your computer and use it in GitHub Desktop.
private static void Folder_OnDrop(object sender, ShellFolderDropEventArgs e)
{
e.AllowedEffects = Constants.DROP_EFFECT_COPY | Constants.DROP_EFFECT_MOVE | Constants.DROP_EFFECT_LINK;
var formats = e.Formats.Split('\n');
var format = formats[0];
int count = 0;
var data = folder.GetDragData(e.TaskId, format, 0, ref count);
if (count > 0)
{
var str = Encoding.Unicode.GetString(data);
Console.WriteLine($"Drop task id: " + e.TaskId + ", target id = " + e.TargetId + ", key state = " + e.KeyState);
var id = folder.PIDLToId(str);
Console.WriteLine(" Drop PIDLToId: " + id);
Console.WriteLine(" Formats: " + e.Formats);
}
}
private static void Folder_OnDrag(object sender, ShellFolderDragEventArgs e)
{
e.AllowedEffects = Constants.DROP_EFFECT_COPY | Constants.DROP_EFFECT_MOVE | Constants.DROP_EFFECT_LINK;
var formats = e.Formats.Split('\n');
var format = formats[0];
int count = 0;
var data = folder.GetDragData(e.TaskId, format, 0, ref count);
if (count > 0)
{
var str = Encoding.Unicode.GetString(data);
Console.WriteLine($"Drag task id: " + e.TaskId + ", target id = " + e.TargetId + ", key state = " + e.KeyState + ", drag type = " + e.DragType);
var id = folder.PIDLToId(str);
Console.WriteLine(" Drag PIDLToId: " + id);
Console.WriteLine(" Formats: " + e.Formats);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment