Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More annoying Ole Drag and Drop 1

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
So I decided it would be far easier from the user interface perspective if I allowed users to drop image files dragged from browser sessions directly onto their control, instead of having to first download load them and then pick them from a directory.

However... the Ole control on this proves to be very complicated, and as yet, I can't figure it out, so seeking some guidance from the community.

It's fairly straight forward at the conceptual level. I have an Image object that has all the necessary OLE bits turned on to accept a Ole drop. But I can't figure out once I drop my item on it, how to manipulate it. (I can create a messagebox that states "Something was dropped" but that's about the extent.

I assume that what is being dropped when dragging an image from a web page is a reference to the image (the name of the file and it's location). If I drag and drop it into a directory in windows, the file just appears there as <filename.ext> and the browser completes a "Download" (shows me on the result bar that the file is there). So obviously windows can handle this kind of "understanding" of what the object is.

How do I manipulate it in VFP to do the same thing? I assume that what I need to do is:

a) "recognize" the object
b) parse the object as some kind of array?
c) Save the image file somewhere (the somewhere is the easy part the "Tell VFP to Save something from the internet" part is what I don't understand how to "tell" it to do it.
d) update my control with reference to the object (also easy)

So steps c and d I think I can manage, it's the a and b that I'm totally stumpped over.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Ok, the ,1 in the call fixed that issue.

But only for the drag where the file name is attached.

Any idea on the other types? Is it possible to drag a linkedIn image onto a VFP form and have it recognized?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
The GETDATA and GETFORMAT help is useless.
I tried other values as well, and mostly just got .F. returned.
I'm just wondering if there is some low-level functional way to get at this data.
Clearly when I pass the fully qualified URL with a file name attached, it's no problem, but apparently the web has changed in how they are able to show this in a Drag/Drop. In the mean time, I do have it working for those that carry it, and I have included a message for others that says "This image can't be dropped here directly from the web. Try saving the image to a folder, and adding it instead". Now I've implemented drag and drop from a folder onto the same point, so the various CASE GETFORMAT() come into effect, so it treats drags from web browser different than a file drag and drop, so at least that is pretty cool.

Thanks for all your help and to tbleken. After trying both the methods, I actually opted for his for 3 reasons:
1) I don't have to have the activex control (I don't like them, and avoid them like the plague)
2) It was actually much faster than OpenURL
3) It did not trigger the Windows "waiting" icon while completing the process (it's instant on my machine, even on an image of 125K+) while OpenURL took 1 - 2 seconds to complete.

I'll monitor it a while. I worry a little bit about the big memory buffer it opens each time, so if that does become a problem, then I'll switch to the OpenURL method.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Mike,
Just wanted to loop back on this...
After using them both for a while I have ultimately adopted your suggestion on this, and I use the ActiveX control for handling it in the forms where I need it. The primary reason was: It recovers much more gracefully from errors (i.e. it doesn't trigger fatal errors that cause VFP processing to stop with ON ERROR calls). And after using it for a week or so solid it has been very stable, and rock solid. SO I highly recommend your solution! Works great!

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top