


LngRet = apiCallWindowProc(ByVal lpPrevWndProc, _īyVal Hwnd, ByVal Msg, ByVal wParam, ByVal lParam) ' Forms!frmDragDrop.Caption = "DragDrop: " & _ ' original code used listbox to show file(s) ' strOut has semi-colon separated list of folders and files StrOut = strOut & Left$(strTmp, intLen) & " " IntLen = apiDragQueryFile(wParam, i, strTmp, cMAX_SIZE) LngCount = apiDragQueryFile(wParam, &HFFFFFFFF, strTmp, Len(strTmp)) Public Sub sDragDrop(ByVal Hwnd As LongPtr, _īyVal Msg As LongPtr, ByVal wParam As LongPtr, _ĭim lngRet As LongPtr, strTmp As String, intLen As Integerĭim lngCount As Long, i As Long, strOut As StringĬonst cMAX_SIZE = 250 ' was 50 in original code Public Declare Function apiDragQueryFile Lib "shell32.dll" _Īlias "DragQueryFileA" (ByVal hDrop As LongPtr, _īyVal iFile As LongPtr, ByVal lpszFile As String, _ Public Declare Sub sapiDragFinish Lib "shell32.dll" _Īlias "DragFinish" (ByVal hDrop As LongPtr) Public Declare Sub sapiDragAcceptFiles Lib "shell32.dll" _Īlias "DragAcceptFiles" (ByVal Hwnd As LongPtr, _ Public Declare Function apiGetWindowLong Lib "user32" _Īlias "GetWindowLongA" (ByVal Hwnd As LongPtr, _ Public Declare Function apiSetWindowLong Lib "user32" _Īlias "SetWindowLongA" (ByVal Hwnd As LongPtr, _īyVal nIndex As LongPtr, ByVal wNewWord As LongPtr) _ Public Declare Function apiCallWindowProc Lib "user32" _Īlias "CallWindowProcA" (ByVal lpPrevWndFunc As LongPtr, _īyVal Hwnd As LongPtr, ByVal Msg As LongPtr, _īyVal wParam As LongPtr, ByVal lParam As LongPtr) _ Public Declare Function FindWindow Lib "user32" _Īlias "FindWindowA" (ByVal lpClassName As String, _ ' Not ready for unicode, uses ANSI call for file name(s) HWndThis = FindWindow(lpClassName:="ThunderXFrame", lpWindowName:=Me.Caption)Ĭopy/paste this code to a separate module: Option Explicit HWndThis = FindWindow(lpClassName:="ThunderDFrame", lpWindowName:=Me.Caption) LngTmp = apiSetWindowLong(Hwnd, GWL_WNDPROC, lpPrevWndProc) LpPrevWndProc = apiSetWindowLong(Hwnd, GWL_WNDPROC, AddressOf sDragDrop) LngRet = apiSetWindowLong(Hwnd, GWL_EXSTYLE, lngStyle) LngStyle = apiGetWindowLong(Hwnd, GWL_EXSTYLE) Sub sEnableDrop(frm As UserForm, Hwnd As LongPtr)ĭim lngStyle As LongPtr, lngRet As LongPtr ' provided the copyright notice is left unchanged.

' You are free to use it in any application,

' It is not to be altered or distributed, ' This code was originally written by Dev Ashish. Copy/paste this code to the code of the userform: Option Explicit Another option for drag/drop of file/folder names.
