Damastah Posted June 9, 2008 Posted June 9, 2008 I'm making a script that will allow a user to drag and drop files to my GUI and then after they're done with the files, will put the file names in a script. Can someone help me on creating the Drag-and-drop window and the function to take the filenames of the dropped files? Thanx.
Bert Posted June 9, 2008 Posted June 9, 2008 If you have the full AutoIt install, use Koda. It will be on the tools menu in SciTe. It is real easy to make what you need. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Lazycat Posted June 9, 2008 Posted June 9, 2008 I think he mean a bit different thing. Here is an example of Drag'n'Drop GUI, similar to famous OggDrop: expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global Const $WM_DROPFILES = 0x233 Global $gaDropFiles[1] #Region ### START Koda GUI section ### Form= $hGUI = GUICreate("", 137, 131, -1, -1, BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_ACCEPTFILES,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUISetBkColor(0xFFFFFF) $hList = GUICtrlCreateLabel("Drop files here", 0, 0, 135, 121, BitOR($SS_CENTER,$SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG) GUICtrlSetState ($hList, $GUI_DROPACCEPTED) $hContext = GUICtrlCreateContextMenu($hList) $hExit = GUICtrlCreateMenuItem("Exit", $hContext) #EndRegion ### END Koda GUI section ### GUIRegisterMsg ($WM_DROPFILES, "WM_DROPFILES_FUNC") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hExit Exit Case $GUI_EVENT_DROPPED For $i = 0 To UBound($gaDropFiles) - 1 ConsoleWrite($gaDropFiles[$i] & @CR) Next EndSwitch WEnd Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i+1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next EndFunc Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now