Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Need Function Drag and Drop for AutoItx64

$
0
0
Func wm_dropfiles_func($hwnd, $msgid, $wparam, $lparam)     Local $nsize, $pfilename     Local $namt = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wparam, "int", -1, "ptr", 0, "int", 255)     For $i = 0 To $namt[0] - 1         $nsize = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wparam, "int", $i, "ptr", 0, "int", 0)         $nsize = $nsize[0] + 1         $pfilename = DllStructCreate("wchar[" & $nsize & "]")         DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wparam, "int", $i, "int", DllStructGetPtr($pfilename), "int", $nsize)         ReDim $gaDropFiles[$i + 1]         $gaDropFiles[$i] = DllStructGetData($pfilename, 1)         $pfilename = 0     Next EndFunc   ;==>wm_dropfiles_func

wm_dropfiles_func Errror:
eror_dnd.png
 
+>AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00000409  OS:WIN_81/  CPU:X64 OS:X64    Environment(Language:0409) AutoIt v3.3.12.0 

Code Example:

AutoIt         
Opt("MustDeclareVars", 1) Opt("TrayAutoPause", 0) Global Const $WS_EX_ACCEPTFILES = 0x00000010 Global Const $WS_EX_TOPMOST = 0x00000008 Global Const $WS_EX_WINDOWEDGE = 0x00000100 Global Const $GUI_EVENT_CLOSE = -3 Global Const $GUI_EVENT_MINIMIZE = -4 Global Const $GUI_EVENT_RESTORE = -5 Global Const $GUI_EVENT_MAXIMIZE = -6 Global Const $GUI_EVENT_PRIMARYDOWN = -7 Global Const $GUI_EVENT_PRIMARYUP = -8 Global Const $GUI_EVENT_SECONDARYDOWN = -9 Global Const $GUI_EVENT_SECONDARYUP = -10 Global Const $GUI_EVENT_MOUSEMOVE = -11 Global Const $GUI_EVENT_RESIZED = -12 Global Const $GUI_EVENT_DROPPED = -13 Global Const $gui_dropaccepted = 8 Global Const $wm_dropfiles = 563 Global Const $CodeBy="Dao Van Trong - Trong.TK" Global $gaDropFiles[1],$sListFileDrop,$sDropsAccept=True ;~ Global Const $GUI_SS_DEFAULT_GUI = BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU) Global $Form1 = GUICreate("Form1", 448, 116, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) Global $Pic1 = GUICtrlCreatePic("C:\Users\TrOnG\Desktop\Image.jpg", 0, 0, 112, 112) GUICtrlSetState(-1, $gui_dropaccepted) Global $sListProcessFile = GUICtrlCreateList("", 112, 1, 333, 112) GUICtrlSetState(-1, $gui_dropaccepted) GUISetState(@SW_SHOW) GUIRegisterMsg($wm_dropfiles, "wm_dropfiles_func") While 1     Local $nMsg = GUIGetMsg()     Switch $nMsg         Case $gui_event_dropped             $sDropsAccept = False             Local $i, $ntotal = UBound($gaDropFiles) - 1             For $i = 0 To $ntotal                 $sListFileDrop &= "|" & $gaDropFiles[$i]             Next             GUICtrlSetData($sListProcessFile, $sListFileDrop)             $sListFileDrop = ""             $sDropsAccept = True         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd Func wm_dropfiles_func($hwnd, $msgid, $wparam, $lparam)     If $sDropsAccept Then     Local $nsize, $pfilename     Local $namt = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wparam, "int", -1, "ptr", 0, "int", 255)     For $i = 0 To $namt[0] - 1         $nsize = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wparam, "int", $i, "ptr", 0, "int", 0)         $nsize = $nsize[0] + 1         $pfilename = DllStructCreate("wchar[" & $nsize & "]")         DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wparam, "int", $i, "int", DllStructGetPtr($pfilename), "int", $nsize)         ReDim $gaDropFiles[$i + 1]         $gaDropFiles[$i] = DllStructGetData($pfilename, 1)         $pfilename = 0     Next     EndIf EndFunc   ;==>wm_dropfiles_func

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>