WS_EX_ACCEPTFILES

Started by Pedro Marquez, November 06, 2013, 06:11:23 PM

Previous topic - Next topic

Pedro Marquez

How to collect data from drag/drog WS_EX_ACCEPTFILES of Texbox.

Paul Squires

Put code like the following in the CUSTOM message handler for the TEXTBOX.


'--------------------------------------------------------------------------------
Function FORM1_TEXT1_CUSTOM ( _
                            ControlIndex  As Long,  _  ' index in Control Array
                            hWndForm      As Dword, _  ' handle of Form
                            hWndControl   As Dword, _  ' handle of Control
                            wMsg          As Long,  _  ' type of message
                            wParam        As Dword, _  ' first message parameter
                            lParam        As Long   _  ' second message parameter
                            ) As Long

   
   Select Case wMsg
   
      Case %WM_DROPFILES
         Local nFileCount As Long
         Local i          As Long
         Local zFilename  As Asciiz * %MAX_PATH
         Local sTemp      As String
         
         nFileCount = DragQueryFile( wParam, -1, ByVal 0, 0 )
         For i = 0 To nFileCount - 1
            DragQueryFile wParam, i, zFilename, SizeOf(zFilename)
            sTemp = sTemp & $CrLf & zFilename
         Next i
         DragFinish wParam
         ? "Dropped filenames: " & $CrLf & $CrLf & Trim$(sTemp, $CrLf)

   End Select
           
End Function

Paul Squires
PlanetSquires Software