-
Jan 20th, 2023, 09:34 AM
#1
Thread Starter
Frenzied Member
fafalone: Drag & Drop freeze/hang issue
Hi,
I've been trying to find an issue with my app for a couple of months now and just today I finally found the cause.
So, I do use the custom Drag & Drop from fafalone: Drag&Drop
After dropping a File from explorer to the Form, I then open a MODAL form for further options. And this is causing a HANG/FREEZE to Windows. If i drag & drop a file from a folder, then it freezes that folder. If i drag & drop from the Desktop, it freezes the desktop.
Only when I close the Modal form, messages are going through again.
And yes, I did try without the drag & drop, the form works fine with no hangs, so definitely the issue is with the IdataObject of the drag & drop class.
Take a look below of what i mean.. (click to view)
Any ideas on how to sort this out?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 20th, 2023, 11:33 AM
#2
Re: fafalone: Drag & Drop freeze/hang issue
Would it be possible to attach the project or a simplified demo where this is happening?
-
Jan 20th, 2023, 12:16 PM
#3
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
Sure, attached is the Original Drag/Drop demo you have, with just an extra form show up when you DROP an image.
DragDrop.zip
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 20th, 2023, 06:36 PM
#4
Re: fafalone: Drag & Drop freeze/hang issue
Can't reproduce it on my system (Windows 10)... Form2 loads, is responsive, as is the source folder. What version of Windows?
-
Jan 20th, 2023, 06:47 PM
#5
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
Ermm.. that's strange?
Win10 here too.
You've seen the attached GIF right ?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 20th, 2023, 07:46 PM
#6
Re: fafalone: Drag & Drop freeze/hang issue
Doesn't faf's code need a typelib? Are you guys using the same tlb version?
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 20th, 2023, 08:44 PM
#7
Re: fafalone: Drag & Drop freeze/hang issue
Originally Posted by some1uk03
Ermm.. that's strange?
Win10 here too.
You've seen the attached GIF right ?
I see it but when I try dropping I get this:
Attachment 186705
-
Jan 21st, 2023, 04:30 AM
#8
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 21st, 2023, 05:30 AM
#9
Re: fafalone: Drag & Drop freeze/hang issue
-
Jan 21st, 2023, 06:10 AM
#10
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
Yes, that's correct. You'll see that new MODAL form with the UNLOAD ME option, but try dragging your Windows Folder around? or Clicking on any of the files inside the project folder..
The Windows Explorer Folder would be locked (i/e not receiving any mouse messages)
Just like here: https://gifyu.com/image/SmHRq
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 21st, 2023, 07:03 AM
#11
Re: fafalone: Drag & Drop freeze/hang issue
It's not locked on my computer. I'll try a few things to see if I can reproduce the issue tomorrow.
-
Jan 21st, 2023, 07:35 AM
#12
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
I just re-tested on a VM with WIN10 again, and same issue there.
Drag a PNG from the DESKTOP and then once the 2nd FORM is shown, I can no longer click on any of the icons on the desktop. It becomes locked.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 21st, 2023, 08:19 AM
#13
Re: fafalone: Drag & Drop freeze/hang issue
From folders too or just the desktop in your VM?
Edit: Wait do you mean while the modal form is up? I thought you meant it froze even after you closed that.
The form is modal, it's expected behavior... execution stops at Form2.Show vbModal, Me until the form is unloaded. So the drop function never returns until that happens, and the window you drag from is waiting on it.
Last edited by fafalone; Jan 21st, 2023 at 08:28 AM.
-
Jan 21st, 2023, 08:54 AM
#14
Member
Re: fafalone: Drag & Drop freeze/hang issue
Originally Posted by some1uk03
Can I ask one offtopic question?
What software did you use to make the gif animation?
It looks nice.
-
Jan 22nd, 2023, 11:26 AM
#15
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
Originally Posted by fafalone
From folders too or just the desktop in your VM?
Edit: Wait do you mean while the modal form is up? I thought you meant it froze even after you closed that.
The form is modal, it's expected behavior... execution stops at Form2.Show vbModal, Me until the form is unloaded. So the drop function never returns until that happens, and the window you drag from is waiting on it.
I'm not referring to the APP being frozen because we have a modal form. I'm referring to WINDOWS EXPLORER being frozen after we drag & drop and show a modal form.
If you initiate the Drag & Drop from a Folder, then the Folder becomes frozen, until we close the modal form.
If you initiate the drag & drop from desktop, then the Desktop becomes frozen, until we close the modal form.
The GIF attached shows that whilst we show the modal form, clicking on the Folder we can't move it, we can't gain focus, we can't click on any files etc... Once the form is unloaded, all messages continue to pump through.
Originally Posted by Zann
Can I ask one offtopic question?
What software did you use to make the gif animation?
It looks nice.
Camtasia
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 22nd, 2023, 01:38 PM
#16
Re: fafalone: Drag & Drop freeze/hang issue
Yes this is the expected behavior, because Explorer is waiting on the drop to complete. The drop does not complete until IDropTarget_Drop exits, which it doesn't until Form2.Show vbModal returns and it hits End Sub.
-
Jan 23rd, 2023, 07:20 AM
#17
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
I did some more testing with the standard VB OleDrop and it does seem to behave the same, which I find strange.
I'm just trying to think ways around it. Rather than re-designing my flow of showing the modal form etc..
Why can't the clearup code happen before the RaiseEvent Drop is called, rather than on existing the SUB ?
Can't we somehow flush and release all object before raising the event, that way it's all cleared up and wouldn't cause a freeze ?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 23rd, 2023, 07:30 AM
#18
Re: fafalone: Drag & Drop freeze/hang issue
Originally Posted by some1uk03
I did some more testing with the standard VB OleDrop and it does seem to behave the same, which I find strange.
I'm just trying to think ways around it.
The usual workaround is:
- to "gobble up all relevant data" from the Data-Object, which you need for further processing immediately
..("parking" it in a Variable of your choice)
- with the goal to exit the OleDrop-Event as fast as possible, but not without starting a little "10msec decoupling timer" as well
- from within the EventHandler of that "decoupling-one-shot-timer" you can then do anything you want
..(disabling the timer itself, followed by showing your modal Form-Popup - because you have your "OleDrop-Data" already buffered in a Variable)
HTH
Olaf
-
Jan 25th, 2023, 12:46 PM
#19
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
Ok, I have now indeed implemented the workaround method with a Timer to launch after a few MS, which solves the issue.
I have come across another issue though.
So we have a DroppedEvent, but that only fires if dropped on the TARGET.
Is there a way to create a new EVENT which acts as a Dropped/MouseUP event, EVEN if the mouse isn't released ABOVE the target ?
I note that the FORMs MouseUP isn't raised if you release/let go over the mouse on drag.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Jan 27th, 2023, 05:49 AM
#20
Thread Starter
Frenzied Member
Re: fafalone: Drag & Drop freeze/hang issue
I wonder if subclassing is the only option left to detect the MouseUp event.
Any other ideas anyone?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|