Wollf Posted December 17, 2008 Posted December 17, 2008 i want to make a box that i want user to drag an item from deskpot and drop it inside a box in the windowbut i dont know how to make the box and how make it able for users to drag and drop also how can i make files to rar files?
rasim Posted December 17, 2008 Posted December 17, 2008 i want to make a box that i want user to drag an item from deskpot and drop it inside a box in the windowbut i dont know how to make the box and how make it able for users to drag and drop also how can i make files to rar files?Example: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Drag & drop demo", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $cListBox = GUICtrlCreateList("", 10, 10, 280, 180) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED GUICtrlSetData($cListBox, @GUI_DRAGFILE & @CRLF, 1) EndSwitch WEnd
Rental Posted December 17, 2008 Posted December 17, 2008 Here is an example Lazycat gave a while ago. 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
Wollf Posted December 17, 2008 Author Posted December 17, 2008 Example: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Drag & drop demo", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $cListBox = GUICtrlCreateList("", 10, 10, 280, 180) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED GUICtrlSetData($cListBox, @GUI_DRAGFILE & @CRLF, 1) EndSwitch WEnd thanks for the example but what exactly it does when you drag file with that order? ($cListBox, @GUI_DRAGFILE & @CRLF, 1)
Wollf Posted December 17, 2008 Author Posted December 17, 2008 because with the first example i only see i can drag files into the list and then their location appear after that to change it do i need to guictrlread the list and then run(guictrlread($clist)) ?
AdmiralAlkex Posted December 17, 2008 Posted December 17, 2008 Why would you use GUICtrlRead() to get a value you already have? Remember that you already have the file in @GUI_DRAGFILE so simply do: Run(@GUI_DRAGFILE) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Wollf Posted December 18, 2008 Author Posted December 18, 2008 thanks for help i tried something now but after i did it doesnt anymore saw the file into the list. Also how can i make files rar instead of run file i want to rar it #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Drag & drop demo", 300, 300, -1, -1, -1, $WS_EX_ACCEPTFILES) $Button1 = GUICtrlCreateButton("button",200,200,50,50) GUICtrlSetOnEvent(-1, "Button1") $cListBox = GUICtrlCreateList("", 10, 10, 280, 180) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Func button1() run(@GUI_DRAGFILE) EndFunc GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED GUICtrlSetData($cListBox, @GUI_DRAGFILE & @CRLF, 1) EndSwitch WEnd
Wollf Posted December 18, 2008 Author Posted December 18, 2008 what i do wrong in the code in previous post?\
youknowwho4eva Posted December 18, 2008 Posted December 18, 2008 1) don't bump in less then 24 hours from your last post. 2) it doesn't work because you are using a while loop with on event mode. Look up the differences in the help file. Giggity
Wollf Posted December 19, 2008 Author Posted December 19, 2008 ah yes i see but if i remove on event mode i wont be able to use buttons because i dont know any other way make buttons function yet. what else i can use instead of onevent mode to make buttons work? also how i can make a normal file i have at list to .rar file?
Rental Posted December 19, 2008 Posted December 19, 2008 for the buttons do something like. $but1 = GuiCtrlCreateButton("button 1", 10, 10) while 1 $msg = Guigetmsg() if $msg = $but1 then msgbox(0, "","Button 1 pressed" endif wend Look it up in the help file, there is all kinds of ways to get a button to work.
Wollf Posted December 19, 2008 Author Posted December 19, 2008 ah yes ty now i now 2 ways to make buttons functions now i need to know how to zip files in list and make them .rar files
Bert Posted December 20, 2008 Posted December 20, 2008 (edited) do a search in the forum for 7-zip. It will do what you need.Edit: here - http://www.autoitscript.com/forum/index.ph...094&hl=7zip Edited December 20, 2008 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/
Wollf Posted January 16, 2009 Author Posted January 16, 2009 is there a way to do that with winrar or i must use 7-zip
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