Jump to content

Search the Community

Showing results for tags 'Drop'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 7 results

  1. Generally speaking, the support for autoit AU3 file drag and drop is not perfect AU3 built-in GUI $WS_ EX_ ACCESSFILES, Control $GUI_ DROPACCEPTED, then @ GUI_ DropId distinguishes the control that occurs, but @ GUI_ DragFile does not support multiple files, only the first file is recognized! And dragging into the window means dragging and dropping the cursor, without distinguishing the display of controls. Common WM_DROPFILES_FUNC, DllCall shell32.dll DragQueryFile, GUI window also $WS_ EX_ ACCESSFILES, supports multiple files, but requires GUI event mode 1, and cannot distinguish which control occurred, making it difficult to handle when there are multiple different drag and drop destinations. Similarly, dragging the cursor into the window does not distinguish the display of controls. Here is an example of AU3 source code that can determine which control triggers the drag, and can support multiple files being dragged in at once, which can be processed one by one without setting GUIOnEventMode to 1 Running under WIN11 has passed. The image shows the system wallpaper of WIN11 or WIN7. If you don't have it, please replace it yourself Select multiple files in the system file browser, then drag them into the program window. When pointing to the blank space, cursor as disabled. When pointing to the Input input box and image, you can release the mouse to complete the drag and drop. The effect is that the input box displays all the file names that were dragged and dropped, and displays the recently dragged control hWnd,for easy differentiation ================== #include <GUIConstants.au3> #include <WinAPI.au3> #include <Array.au3> Global $aFileList, $lastDragID $hGUI = GUICreate("Independent control multi file drag", 565, 247, -1, -1, -1, $WS_EX_WINDOWEDGE) $Input1 = GUICtrlCreateInput("", 32, 16, 505, 121) ; Now only here the drop sign appears $defpic1 = "C:\Windows\Web\Wallpaper\Spotlight\img50.jpg" ;win11壁纸1 $defpic2 = "C:\Windows\Web\Wallpaper\Windows\img19.jpg" ;win11壁纸2 $defpic = "" For $i = 1 To 5 If Random(0, 1, 1) Then $defpic = $defpic1 Else $defpic = $defpic2 EndIf Assign("Pic" & $i & "Handle", GUICtrlCreatePic($defpic, 20 + (($i - 1) * 100), 180, 90, 50, -1, $WS_EX_ACCEPTFILES)) GUICtrlSetState(Eval("Pic" & $i & "Handle"), $GUI_DROPACCEPTED) Next GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $idDummy = GUICtrlCreateDummy() GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") For $i = 1 To 5 Assign("gchp" & $i, GUICtrlGetHandle(Eval("Pic" & $i & "Handle"))) Assign("wProcOld" & $i, _WinAPI_SetWindowLong(Eval("gchp" & $i), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idDummy For $i = 1 To $aFileList[0] ConsoleWrite($aFileList[$i] & @CRLF) ;拖放处理文件段 Next GUICtrlSetData($Input1, $lastDragID & "##" & _ArrayToString($aFileList, "|", 1)) For $i = 1 To 5;提示哪个控件响应 If Eval("gchp" & $i) = $lastDragID Then MsgBox(0, "idP-" & $i, _ArrayToString($aFileList, @CRLF, 1)) Next EndSwitch WEnd GUIDelete($hGUI) DllCallbackFree($wProcHandle) Func _WindowProc($hWnd, $Msg, $wParam, $lParam) For $j = 1 To 5 ;拖放识别控件段 If $hWnd = GUICtrlGetHandle(Eval("Pic" & $j & "Handle")) Then isDrag($hWnd, $Msg, $wParam, $lParam, Eval("wProcOld" & $j)) Next EndFunc ;==>_WindowProc Func isDrag($hWnd2, $Msg2, $wParam2, $lParam2, $wProcOldx) If $Msg2 = $WM_DROPFILES Then $lastDragID = $hWnd2 ConsoleWrite($lastDragID & @CRLF) $aFileList = _WinAPI_DragQueryFileEx($wParam2) If Not @error Then GUICtrlSendToDummy($idDummy) _WinAPI_DragFinish($wParam2) Return 0 Else Return _WinAPI_CallWindowProc($wProcOldx, $hWnd2, $Msg2, $wParam2, $lParam2) ;放行相应控件的其它消息 EndIf EndFunc ;==>isDrag ================= 单控件多文件拖放22.au3
  2. Send "Drag & Drop File(s)" Message I was looking for this functionality before, and couldn't figure out the correct method for using the WM_DROPFILES message. Thankfully today I came across the thread ' and found working, but flawed, code for doing exactly this. Specifically, (his 'DoDragDrop' function). I cleaned up the code, added error checking, Unicode & x64 support, and fixed the Global memory management issues. The result is down below. Also, see ProgAndy's COM implementation of Drag&Drop: ' Another good reference, besides those in the thread above, is this article at CodeProject: 'How to Implement Drag and Drop Between Your Program and Explorer' Examples of usage: TeraCopy _FileDragDrop(WinGetHandle("[REGEXPTITLE:TeraCopy.*]"),@ScriptFullPath&'|'&@AutoItExe) Notepad++: $hNPPlus=WinGetHandle("[CLASS:Notepad++]") $aNPPPos=WinGetPos($hNPPlus) ;~ WinActivate($hNotePad) $sProgramFiles=@ProgramFilesDir If @AutoItX64 Then $sProgramFiles&=' (x86)' $iRet=_FileDragDrop($hNPPlus,@ScriptFullPath&'|'&$sProgramFiles&"\AutoIt3\Include\Memory.au3",$aNPPPos[2]/2,$aNPPPos[3]/2) ConsoleWrite("Return: "&$iRet&" @error="&@error&", @extended="&@extended&@CRLF) Be sure to credit the original authors, or leave the headers intact, if you use the code *edit: for some friggin reason I can't post the code in the post - I get a 'You must enter a post' error message - wtf. Attaching it for now.. UPDATES: 2010-12-4 (yup, today!): Fixed ANSI implementationChanged Memory allocation type to 'Fixed' (thanks trancexx)Added X, Y position parameters - actually needed for some programs (Notepad++ for example)_FileDragDrop.au3
  3. Hi all, I got a quick question regarding Drag&Drop with GUIs. I made a little script that does something with files and I need a way to get the name/path of the file when I drag&drop it into the GUI. Is there a quick way to do this? Tyvm in advance! Neo
  4. Hello Great AutoIt Members I want to drag and drop a file from 1st window to a 2nd window of an application. I use the MouseClickDrag() function, and it's working good if I specified the X,Y coordinates manually of the file to be dragged and dropped my problem now is how I can get the file position (X,Y coords) in the screen automatically? I've tried this code by browsing the file location in an IE browser object (since the GUI window will be empty other than my file and it'll be easy to get file position relative to the GUI window) but it's not working in win8 #include <IE.au3> $oIE = _IECreateEmbedded() $exp_hwnd = GUICreate("", 200, 200, 0, 0) GUICtrlCreateObj( $oIE, 0, 0 , 200, 200 ) GUISetState () _IENavigate($oIE, @DesktopDir, 0) sleep(1000) MouseClickDrag( "left", 50, 50, 300, 300) I hope anyone has any other solution to this simple problem. thanks for any help
  5. Hi! So what I need is a context menu like that from explorer when you right click on desktop. But i don't know if that is possible. I searched a little and I found nothing, maybe you guys have any ideas ? I mean something like that : But...I know how do that from the GUIcreateblahblah side...now the problem is that I want to do that without GUI! Like: if _IsPressed( "02", "user32.dll" ) then _Context(..) endif Please help!
  6. I am currently trying to make a program but don't know where to start with a drag and drop function. Basically, I wish to drag an image onto my compiled program, and it displays the information of the image. I'm looking for a way to start my program by dragging an image over it and accept the image's location detail.. I'd really appreciate some help on this, for I'm not fully sure how to go about this.
  7. Hi, Is it possible to drop or send a file (respectively a path) to a window, thus simulating a drag-and-drop operation? I want to avoid having to open the open file dialog. Thx and regards, Stephan
×
×
  • Create New...