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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag and Drop from Windows Explorer

Status
Not open for further replies.

trevr1

Programmer
Feb 4, 2003
23
US
Hello,

Here is what I'm trying to accomplish: I want to drag a picture file name from Windows Explorer and drop it into a picture box onto the form. Can this be done? I've tried a couple things but can't seem to make it happen. Any ideas would be greatly appreciated.
 
Explore the OLE Drag/Drop methods and properties for the form/textbox you're using.

I played with it some, but couldn't get it to work with windows explorer, either.
 
trevr1

Probably part of your solution, is to use a Webbrowser Activex control on your form (or on another form), set to navigate to your c:\, it will "look like" Window explorer, but you can control more the drag and drop events if they are withing VFP. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike and WGCS,

Thanks for your help. I tried integrating the Web browser active x control on the form and it works. However, I can't seem to change the views of the files i.e. details, thumbnails, etc. I would really like them to have the option to click on thumbnails (XP, me users) within the windows explorer active x control. Is there a property that triggers this?
 
trevr1

You'll need to modify the following code - I've stripped it out of the .OLEDragDrop() event of a grid so it caters for multiple files being dropped.

Also ensure that .OLEDropMode = 1

LPARAMETERS oDataObject ,;
[tab]nEffect,;
[tab]nButton,;
[tab]nShift,;
[tab]nXCoord,;
[tab]nYCoord

LOCAL aFiles[1] ,;
[tab]i

oDataObject.GETDATA(15,@aFiles)
IF ALEN(aFiles) > 0
[tab]CREATE CURSOR AUTO_CREATE (filename C(254))
[tab]FOR i = 1 to ALEN(aFiles)
[tab][tab]INSERT INTO AUTO_CREATE (filename) VALUES (UPPE(SUBS(aFiles(i),1,1));
[tab][tab][tab]+ LOWE(SUBS(aFiles(i),2)))
[tab]ENDF
ENDI
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Hi Chris,

I appreciate your help. I actually got it to work by dragging the pic from Windows Explorer and dropping it onto the picture box. I took some of the code from this sample form from fox: C:\Program Files\Microsoft Visual FoxPro 7\Samples\Solution\Tahoe\querrydd In this form, you will see the windows explorer window on the second page tab. That is exactly what I'm shootin for, but I can't change the views (i.e thumbnail images) or go up a directory or select a different drive. Any ideas?
 
Excellent Example, Chris!

I thought I was doing almost exactly that, but It just Wouldn't work for me! (I now know I wasn't calling GetData with the right parameters, but the "DragOver" icon wasn't even showing right for me before! And I had remembered the OLEDropMode property)
 
wgcs

Thanks for the kind comments.

The alternative to accepting OLE drag and drop, ie dragging and dropping from VFP onto Windows Explorer, etc, also seems to be lacking in examples and documentation.

If anyone is interested in the other 'half', please advise and a FAQ will follow.
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top