Solved

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

Posted on 1997-05-20
4
201 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now