Achilles Posted July 11, 2007 Share Posted July 11, 2007 Anybody have any ideas how I could drag multiple files/folders onto a GuiList? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
ashley Posted July 11, 2007 Share Posted July 11, 2007 Anybody have any ideas how I could drag multiple files/folders onto a GuiList?do u meen treeview... Free icons for your programs Link to comment Share on other sites More sharing options...
ChrisL Posted July 11, 2007 Share Posted July 11, 2007 Here is some code I stripped out of a Phillips MP3 manager I made, Is this what you are after? expandcollapse popup#Include <GuiConstants.au3> #Include <GuiListView.au3> Global $gaDropFiles[1] Global Const $WM_DROPFILES = 0x233 $Form1 = GUICreate("Philips SA260 Manager", 633, 467, -1, -1,-1,BitOr($WS_EX_ACCEPTFILES,$WS_EX_DLGMODALFRAME)) ;Main listview which accepts droped items $ListView1 = GUICtrlCreateListView("Files", 152, 54, 473, 300,-1) _GUICtrlListViewSetColumnWidth ( -1, 0, 400) GUICtrlSetState($ListView1, $GUI_DROPACCEPTED) GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC') GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GuiSetState() While 1 $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $str = "" For $i = 0 To UBound($gaDropFiles) - 1 GuiCtrlCreateListViewItem($gaDropFiles[$i],$ListView1) 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 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Achilles Posted July 16, 2007 Author Share Posted July 16, 2007 Here is some code I stripped out of a Phillips MP3 manager I made, Is this what you are after? expandcollapse popup#Include <GuiConstants.au3> #Include <GuiListView.au3> Global $gaDropFiles[1] Global Const $WM_DROPFILES = 0x233 $Form1 = GUICreate("Philips SA260 Manager", 633, 467, -1, -1,-1,BitOr($WS_EX_ACCEPTFILES,$WS_EX_DLGMODALFRAME)) ;Main listview which accepts droped items $ListView1 = GUICtrlCreateListView("Files", 152, 54, 473, 300,-1) _GUICtrlListViewSetColumnWidth ( -1, 0, 400) GUICtrlSetState($ListView1, $GUI_DROPACCEPTED) GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC') GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GuiSetState() While 1 $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $str = "" For $i = 0 To UBound($gaDropFiles) - 1 GuiCtrlCreateListViewItem($gaDropFiles[$i],$ListView1) 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 EndFuncAWESOME! Thanks! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
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