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 Chris Miller 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 files onto a VB form 1

Status
Not open for further replies.

jmarler

Programmer
Jan 29, 2001
679
US
Here's the basic idea . . . I want to be able to select a group of icons in Windows Explorer and then drag and drop them into/onto an open form in a running VB application. The application should then automatically know what files were selected and process them.
If I remember correctly, there is a set of APIs that will enable a VB form to intercept the OS message for the Drag and Drop, but I do not remember what they are or how to use them.
Anyone here ever try this before and if so, I'd love to know how you did it. Thanks for the info! - Jeff Marler
(please note, that the page is under construction)
 
Drag Files From Windows To A Form, And Get Their Full Path
If you will drag c:\autoexec.bat and c:\setup.ini to your form, on the form will be printed:
c:\autoexec.bat
c:\setup.ini

You can do the same with other control, for example, let the user drag files to picture box, list box and so on.



Preparations
Set the Form OLEDropMode Property to 1 - manual

Form Code
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long , _
Button As Integer, Shift As Integer, X As Single, Y As Single )
For i = 1 To Data.Files.Count
Print Data.Files(i)
Next i
End Sub
Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX.

Download Demo version on my Site:
Promotions before 02/28/2001 (free source codebook),visite my site
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top