Implementing a clone of the 'Run' dialog

I'm trying to implement a clone of the 'run' dialog on the start menu under VB. This is done using 'drag and drop' api's. I have got it to accept files to be dragged on it by registering it as a droppable area, but now I need to get the file name of the file which has been dropped on to the text box. This is done using DragQueryFile, but MSDN is very vague and says that a parameter wParam is a pointer to an internal buffer containing the file name. Can anyone help me to get the file name?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

First, set the textbox's OLEDropMode to 1 (Manual), then use the following code: (I have assumed that the text box is called "Text1"). This code supports multiple item drop, and it also checks whether the dropped item(s) is/are folders or files.

Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, button As Integer, Shift As Integer, x As Single, y As Single)
    Dim i As Byte
    Dim Filename As String

    On Error GoTo ErrorHandler
    Do While True
        i = i + 1
        Filename = Data.Files(i)
        'Test whether dropped item is a file or folder
        If GetAttr(Filename) And vbDirectory Then
            'Dropped Item is a folder
            MsgBox "User dropped a folder"
            'Dropped Item is a file
            MsgBox "User dropped a file"
        End If

On Error GoTo 0
End Sub


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.