You might be able to detect it by monitoring the creation on desktop window that appears when the mouse drag operation begins.
// Add ref UIAutomationClient and UIAutomationTypes
var root = System.Windows.Automation.AutomationElement.RootElement;
var walker = System.Windows.Automation.TreeWalker.RawViewWalker;
System.Windows.Automation.Automation.AddStructureChangedEventHandler(root, System.Windows.Automation.TreeScope.Children, (s, e) =>
{
if (e.StructureChangeType == System.Windows.Automation.StructureChangeType.ChildAdded)
{
var child = walker.GetFirstChild(root);
while (child != null)
{
string className = "";
try
{
className = child.Current.ClassName;
}
catch
{
child = walker.GetNextSibling(child); //
continue;
}
if (className == "SysDragImage")
{
Console.WriteLine("Detect Drag" + System.Windows.Forms.Cursor.Position);
break;
}
child = walker.GetNextSibling(child);
}
}
});
# Fix inifinite loop