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?
DeltaWorkshopAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
autConnect With a Mentor Commented:
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"
        Else
            'Dropped Item is a file
            MsgBox "User dropped a file"
        End If
    Loop

ErrorHandler:
On Error GoTo 0
End Sub
'----------------------


0
All Courses

From novice to tech pro — start learning today.