Search the Community
Showing results for tags 'WM_DROPFILES'.
-
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