I'm making a program in VB.NET, which does some file processing on a folder that is dragged into the form control. When the folder is dropped, all I really need is the path to it, and then explorer can go about its day. But the event that the drop calls (Me.DragDrop) freezes the explorer instance that the folder was dragged from until my work is done. Here's what I've got:
Public Sub FileEnter(sender As Object, e As DragEventArgs) Handles Me.DragEnter If e.Data.GetDataPresent(DataFormats.FileDrop) Then e.Effect = DragDropEffects.Copy End Sub Public Sub FileDrop(sender As Object, e As DragEventArgs) Handles Me.DragDrop dropPath = CType(e.Data.GetData(DataFormats.FileDrop), String()).First Dim files = Directory.GetFiles(dropPath, "*", SearchOption.AllDirectories) . . . End Sub
once I have dropPath, I don't need the drop event anymore, but it holds on.
https://stackoverflow.com/questions/65894568/explorer-freezes-when-dragging-folder-until-vb-event-is-finished January 26, 2021 at 09:08AM
没有评论:
发表评论