Solved

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

Posted on 1997-05-20
4
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

761 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