Solved

File Manager Drag and Drop to a VB4 form in NT3.51

Posted on 1997-05-20
4
204 Views
Last Modified: 2012-06-27
How do I get a VB4 form to accept drag and drop files from the file manager and then retrieve the filenames. I could do this in VB3 in Win 3.11 but the method doesn't work in VB4 and NT3.51.

The API calls DragAcceptFiles, DragQueryFiles and DragFinish turn on draggin and dropping, allow the filenames to be retrieved and stop dragging and droping respectively. But how do I detect the drop event (and how do I know my form was the one dropped on)?
0
Comment
Question by:coons
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:tward
ID: 1426431
Try the following API calls:

DragAcceptFiles, DragFinish: Support File Manager drag/drop file ability.

I haven't had time to get them to work yet but here are some declarations:

Declare Sub DragAcceptFiles Lib "shell32.dll" Alias "DragAcceptFiles" (ByVal hwnd As Long, ByVal fAccept As Long)

Declare Function DragDetect Lib "user32" Alias "DragDetect" (ByVal hWnd As Long, ByVal pt As POINTAPI) As Boolean

Declare Sub DragFinish Lib "shell32.dll" Alias "DragFinish" (ByVal hDrop As Long)

Declare Function DragObject Lib "user32" Alias "DragObject" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal un As Long, ByVal dw As Long, ByVal hCursor As Long) As Long

Declare Function DragQueryFile Lib "shell32.dll" Alias "DragQueryFileA" (ByVal HDROP As Long, ByVal UINT As Long, ByVal lpStr As String, ByVal ch As Long) As Long

Declare Function DragQueryPoint Lib "shell32.dll" Alias "DragQueryPoint" (ByVal HDROP As Long, lpPoint As POINTAPI) As Long
0
 

Author Comment

by:coons
ID: 1426432
Edited text of question
0
 

Author Comment

by:coons
ID: 1426433
How do I detect the drop event (see new question text)?
0
 
LVL 7

Accepted Solution

by:
tward earned 50 total points
ID: 1426434
The only way that I have seen is through a program that can hook into the messages.  You have to trap the WM_DROPFILES Message.  There are several Shareware OCX's that hook into the messages.  One that comes to mind is Message Blaster.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now