Drag and Drop von Listview zu z.B. Filezilla

  • Hi Leute.
    Ich habe Daten in einer Listview. Ich möchte nun per Drag and Drop einen Listview Eintrag nach Filezilla (als Beispiel) zeihen. Dabei soll nachgesehen, welche id zu dem Eintrag gehört und der entsprechende Pfad aus einer Datenbank abgefragt werden. Dieser Pfad müsste dann als Drag and Drop an FileZilla gegeben werden.
    Es ist ja nicht schwer, abzufragen, welcher eintrag markiert ist und welche id dazugehört. An den Pfad komme ich also ohne Probleme, doch wie bestimme ich, was beim Drag and Drop an FileZilla weitergegeben wird?

    Ich hoffe, ihr könnt mir helfen!

    Mfg Kana

  • Auf das doDropFile bin ich schon gestoßen, ich wollte das ganze aber eher allgemein halten, nicht auf ein bestimmtes Fenster bezogen.
    Beim Drag and Drop gibt ja der Explorer den Pfad der Dateien mit. Das kann dann weiterverarbeitet werden. Ich möchte diesen Pfad praktisch manuell eintragen, sodass es wäre, als wenn ich die Datei vom Explorer in das externe Fenster ziehe, Nur, dass das von meiner Listview gezogen wird. Wohin ich ziehe ist dabei also egal. Wichtig ist nur, was/wie gedroppt wird.

    Könnte man theoretisch Abfragen, welches Fenster unter der Maus ist, und davon dann den handle ermitteln?

  • Danke für den Tipp, misterspeed.
    Hab das gleich mal umgesetzt. Jetzt habe ich allerdings das Problem, dass das

    [autoit]


    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')

    [/autoit]


    nur bei Drag and Drops von einem Externen Programm IN meine GUI auslöst. Nicht, wenn ich in eine andere Gui verschiebe.
    In der Hilfe finde ich keine andere Möglichkeit. Hätte da noch jemand eine Idee?

    (Oder mach ich was bei der Erzeugung des Listviews was falsch? Ich kann nämlich nirgendwo hinziehen. Es erscheint nur das +-Symbol an der Maus (grau)?)

    Spoiler anzeigen
    [autoit]

    $MainGui = GUICreate("Bücherverwaltung", $guiInfo[2], $guiInfo[3]-25, $guiInfo[0], $guiInfo[1],$WS_CAPTION +$WS_SYSMENU+ $WS_SIZEBOX +$WS_MINIMIZEBOX+$WS_MAXIMIZEBOX,$WS_EX_ACCEPTFILES)

    [/autoit][autoit]

    $MainGui_MainListView = GUICtrlCreateListView("", 200, 40, $MainGui_size[0]-500, $MainGui_size[1]-85)
    GUICtrlSetResizing ( -1, 102 )
    GUICtrlSetState(-1,$GUI_DROPACCEPTED)

    [/autoit]
  • Ähm ja dafür ist das ja auch gedacht. Die externe GUI muss selbst Drops erlauben, so wie du es oben mit deinen eigenen GUI Elementen gemacht hast. Nur weil du Drops erlaubst bedeutet das ja noch lange nicht, dass andere Programme das auch tun müssen/sollen/wollen was auch immer. Sofern sie es tun musst du den Drop auf dieses Fenster eben auslösen, siehe dodropfiles().


    Nochmal zur Vorgehensweise:

    1. Du ermittelst bei "Maus DOWN" welches Element in deinem Listview angeklickt wurde, schaust meinetwegen in irgendeiner DB nach und hast letztlich den Pfad und Dateinamen der zu droppenden Datei.
    2. Sobald "Maus UP" schaust du mit den Methoden aus meinem zweiten Link nach wie das Handle des Fensters lautet über dem sich die Maus gerade befindet.
    3. Nun rufst du die Funktion dodropfiles() mit dem ermittelten Handle und der ermittelten Datei auf. Daraufhin sollte eine Dropmessage mit dem Dateipfad an das betreffende Fenster geschickt werden.


    Zum Testen würde ich im übrigen Textdateien und Notepad verwenden, hier funktioniert ein Dateidrop mittels dodropfiles() auf jedenfall.

    2 Mal editiert, zuletzt von misterspeed (19. April 2014 um 18:41)

  • Mittlerweile klappt das Verschieben, aufgrund deiner guten Tipps, beim SciTe-Editor oder Notepad.
    Jetzt weiß ich nur nicht, wie ich es hinbekomme, dass auch andere Programme das annehmen, denn nichtmal mein eigenes kleines Testscript:

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    $form1=GUICreate("",620,100,-1,-1,-1,$WS_EX_ACCEPTFILES)
    $input1=GUICtrlCreateInput("",10,10,600,30)
    GUICtrlSetState(-1,$GUI_DROPACCEPTED)
    GUISetState(@SW_SHOW)
    while 1
    sleep(100)
    WEnd

    [/autoit]


    akzeptiert, was ich übergebe... ?(


  • denn nichtmal mein eigenes kleines Testscript:
    ...
    akzeptiert, was ich übergebe... ?(

    Hier ist denke ich keiner Hellseher. Was du nun übergibst oder auch nicht steht hier nirgendwo. Ich schlage also mal vor, dass du so langsam deine Versuche des sendenden Scriptes hier postest, denn um das geht es ja schließlich. Dann kann man das zum einen auch mal testen und zum anderen kann man sich dann auch drüber unterhalten in welchen externen Programmen es nicht und vorallem warum es gerade dort nicht funktioniert.

    Einmal editiert, zuletzt von misterspeed (19. April 2014 um 23:00)

  • Übergeben wird der Windows-handle, sowie die ControlID von der _Mouse_Control_GetInfoAdlib(), welche du gepostet hast, sowie unter $Files einen Pfad als String (z.B.: C:\test\test.epub)

    Spoiler anzeigen
    [autoit]

    Func DoDropFiles($wnd, $Files,$cID)
    if _GUICtrlListView_GetSelectionMark (GUICtrlGetHandle($MainGui_MainListView))<>-1 then
    ;msgbox(48,"",$wnd&"|:|"&$Files&"|:|"&$cID)
    ;$wnd is the handle of the control we are dropping onto
    ;$Files is the list of files separated by "|"
    $tagStruct1 = "int offset;int px;int py;byte fNC;byte fWide"

    [/autoit] [autoit][/autoit] [autoit]

    ;grab some memory
    $hGlobal = _MemGlobalAlloc(14 + StringLen($Files) + 2)
    ;DropFiles := GlobalLock(MemHandle)
    ;translates the memory handle to a pointer
    $pDropFiles = _MemGlobalLock($hGlobal)
    ;create the struct in this memory
    $DropFiles = DllStructCreate($tagStruct1 & ";char filelist[" & StringLen($Files) + 2 & "]", $pDropFiles)
    DllStructSetData($DropFiles, "offset", 14);14 = int+int+int+byte+byte
    $dummy = 0; done its job
    DllStructSetData($DropFiles, "px", 0);tried setting a point inside Notepad
    DllStructSetData($DropFiles, "py", 0);but it makes no difference
    DllStructSetData($DropFiles, "fwide", 0)
    DllStructSetData($DropFiles, "fNC", 0)
    DllStructSetData($DropFiles, "filelist", $Files)
    ;set the nulls in place of the separaters
    $Size = 0;
    $Files = StringSplit($Files, "|")
    For $I = 1 To $Files[0]

    [/autoit] [autoit][/autoit] [autoit]

    ;// number of characters per string (as ANSI) plus one #0 terminator
    ;Inc(Size, Length(Files[I]) + 1);
    $Size += StringLen($Files[$I]) + 1
    DllStructSetData($DropFiles, "filelist", 0, $Size)
    Next
    ;ConsoleWrite(DllStructGetData($DropFiles, "filelist") & @CRLF)
    ;now add the extra null to terminate the list of strings
    DllStructSetData($DropFiles, "filelist", 0, $Size + 1)
    _MemGlobalUnlock($hGlobal)
    ;_WinAPI_PostMessage($wnd, $WM_DROPFILES, $hGlobal, 0);
    _WinAPI_PostMessage($wnd, $WM_DROPFILES, $hGlobal, $cID)
    ;// ... and finally release the memory

    [/autoit] [autoit][/autoit] [autoit]

    _MemGlobalFree($hGlobal)
    EndIF
    EndFunc;==>DoDropFiles

    [/autoit]

    PS: Ich bezweifle, dass du dich durch meine ~1500 Zeilen Code durchwurschteln möchtest. Ich bin mit Kommentaren sehr "zurückhaltend" :whistling:
    PPS: Sry, dass ich die Übergabeparameter nicht gleich dabei hatte... Ich hatte den Post vorm Abschicken nochmal neu geschrieben und das dann vergessen :whistling:

  • PS: Ich bezweifle, dass du dich durch meine ~1500 Zeilen Code durchwurschteln möchtest. Ich bin mit Kommentaren sehr "zurückhaltend" :whistling:

    Niemand braucht hier 1500 Zeilen Code um dein Problem nachvollziehen zu können. Ein simples lauffähiges Testscript reicht völlig (GUI mit Listview und 2-3 auswählbare Einträge, sämtlicher Code der von dir zur Ermittlung des drop (Fenster)handles und zur Ausführung der Dropsache verwendet wird.) Das ist vermutlich mit 200-300 Zeilen getan, wenn überhaupt so viel. Dazu wären dann Infos brauchbar welche Programme nicht funktionieren, wo genau im Fenster der Anwendung gedroppt werden soll/muss und was dein Debugging in solchen Fällen ergibt.

    Deine Dodropfiles Funktion unterscheidet sich jedenfalls von meiner und der im englischen Forum. Woher kommt der Parameter $cID und was soll damit bewirkt werden? Soweit ich die Diskussion dort verstanden habe kann man anstatt an das Fensterhandle + Koordinaten auch an das Controlhandle droppen. Dafür braucht es aber keine Änderung der Funktion, man übergibt einfach controlgethandle anstatt wingethandle für den Parameter $wnd

    Alternativ kann man auch in der Struct die Werte für px und py modifizieren um ein Drop auf eine bestimmte Stelle im Fenster anhand der Koordinaten zu erreichen. Da du die relative Mausposition im Fenster recht einfach bekommen kannst würde ich genau diesen Ansatz verwenden. Das dürfte im übrigen auch der Grund sein warum der Drop auf deine eigene Testgui nicht klappt. Standardmässig dropt die Funktion an die Stelle x=0 und y=0. Deine GUI erlaubt aber nur drops auf das input control, welches eben nicht an der Position x=0 und y=0 ist. Du könntest also nun statt dem winhandle das controlhandle an dodropfiles übergeben oder du nimmst das winhandle plus passende Koordinaten. Beides sollte zum Erfolg führen.

    2 Mal editiert, zuletzt von misterspeed (20. April 2014 um 11:18)

  • So. Hier ein lauffähiges Programm, wie ich es Verwende:
    Die Koordinaten habe ich angefügt. Es funktioniert aber trotzdem nur beim Notepad.
    Wenn ich die $cID einfüge funktioniert es nichteinmal beim Notepad (weiß aber nicht, wie ich die control sonst angeben könnte).

    Beim Explorer funktionieren auch die Methoden unter _MouseUp() nicht.
    Zum testen benutze ich SciTe, Explorer, Filezilla.
    Ich hoffe, du kannst mir beim anpassen des Scriptes helfen.

    Spoiler anzeigen
    [autoit]

    #include "MouseOnEvent.au3"
    #include <GuiListView.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $pos1 = MouseGetPos(),$pos2 = MouseGetPos(),$appHandle = 0,$mouseDown=false
    _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "_MouseUp")
    _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDown")

    [/autoit] [autoit][/autoit] [autoit]

    $MainGui = GUICreate("Bücherverwaltung", 800, 600, -1, -1,$WS_CAPTION +$WS_SYSMENU+ $WS_SIZEBOX +$WS_MINIMIZEBOX+$WS_MAXIMIZEBOX,$WS_EX_ACCEPTFILES)
    $MainGui_MainListView = GUICtrlCreateListView("Pfad", 10, 10,790 ,570 )
    GUICtrlSetResizing ( -1, 102 )
    GUICtrlSetState(-1,$GUI_DROPACCEPTED)
    GUICtrlCreateListViewItem("C:\Test\Test1.epub",$MainGui_MainListView)
    GUICtrlCreateListViewItem("C:\Test\Test2.epub",$MainGui_MainListView)
    GUICtrlCreateListViewItem("C:\Test\Test3.epub",$MainGui_MainListView)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "MainGui_Close")

    [/autoit] [autoit][/autoit] [autoit]

    while 1
    sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func MainGui_Close()
    exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MouseDown()
    $mouseDown=_Mouse_Control_GetInfoAdlib()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MouseUp()
    if $mouseDown then
    ;If _IsMouseInWindow() = False Then
    if _GUICtrlListView_GetSelectionMark (GUICtrlGetHandle($MainGui_MainListView))<>-1 then
    $mousePos = MouseGetPos()
    $wInfo = _WinInfoFromPoint($mousePos[0], $mousePos[1])
    $pfadtmp=_GUICtrlListView_GetItemText(GUICtrlGetHandle($MainGui_MainListView),_GUICtrlListView_GetSelectionMark (GUICtrlGetHandle($MainGui_MainListView)),0)
    ;@Scriptdir&MainGetDataRet("Select path as pfad from Buecher where id="&int(_GUICtrlListView_GetItemText(GUICtrlGetHandle($MainGui_MainListView),_GUICtrlListView_GetSelectionMark (GUICtrlGetHandle($MainGui_MainListView)),0)))[2]
    If $wInfo[1] = "SysListView32" And $wInfo[3] = "Progman" Then
    ;Detect Desktop
    FileCopy($pfadtmp , @DesktopDir)
    msgbox(48,"","filecopy")
    ElseIf $wInfo[1] = "SysListView32" And $wInfo[3] = "CabinetWClass" Then
    ;Detect Explorer.exe Window!!!
    $oldData = _ClipBoard_GetData()
    $newData = _ClipPutFile($pfadtmp)
    $conSend = ControlSend($wInfo[4], "", "SysListView321", "Paste: ^v")
    Sleep(1000)
    _ClipBoard_SetData($oldData)
    ;DoDropFiles($wInfo[4], "C:\testfile.txt") - Doesn't Work :(
    msgbox(48,"","controlSend")
    Else
    DoDropFiles($wInfo[4], $pfadtmp)
    ;msgbox(48,"","DoDropFiles")
    EndIf
    EndIf
    ;_Mouse_Control_GetInfoAdlib(@Scriptdir&MainGetDataRet("Select path as pfad from Buecher where id="&int(_GUICtrlListView_GetItemText(GUICtrlGetHandle($MainGui_MainListView),_GUICtrlListView_GetSelectionMark (GUICtrlGetHandle($MainGui_MainListView)),0)))[2])
    $mouseDown=false
    endif
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Mouse_Control_GetInfoAdlib($Files=-1)
    if $Files<>-1 then
    $pos1 = MouseGetPos()
    ;If $pos1[0] <> $pos2[0] Or $pos1[1] <> $pos2[1] Then ; has the mouse moved?
    Local $a_info = _Mouse_Control_GetInfo()
    Local $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $a_info[0]) ; get the ID of the control
    If @error Then Return
    $GuiWhnd=WinGetHandle("Bücherverwaltung")
    if _WinAPI_GetAncestor($appHandle, $GA_ROOT)<>$GuiWhnd then
    DoDropFiles(_WinAPI_GetAncestor($appHandle, $GA_ROOT), $Files,$aDLL[0])
    endif
    #cs
    ToolTip("Handle = " & $a_info[0] & @CRLF & _
    "Class = " & $a_info[1] & @CRLF & _
    "ID = " & $aDLL[0] & @CRLF & _
    "Mouse X Pos = " & $a_info[2] & @CRLF & _
    "Mouse Y Pos = " & $a_info[3] & @CRLF & _
    "ClassNN = " & $a_info[4] & @CRLF & _ ; optional
    "Parent Hwd = " & _WinAPI_GetAncestor($appHandle, $GA_ROOT))
    #ce
    ;$pos2 = MouseGetPos()
    ;EndIf
    else
    $pos1 = MouseGetPos()
    Local $a_info = _Mouse_Control_GetInfo()
    Local $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $a_info[0]) ; get the ID of the control
    If @error Then Return
    $GuiWhnd=WinGetHandle("Bücherverwaltung")
    if _WinAPI_GetAncestor($appHandle, $GA_ROOT)=$GuiWhnd then
    return true
    endif
    endif
    EndFunc ;==>_Mouse_Control_GetInfoAdlib

    [/autoit] [autoit][/autoit] [autoit]

    Func _Mouse_Control_GetInfo()
    Local $client_mpos = $pos1 ; gets client coords because of "MouseCoordMode" = 2
    Local $a_mpos
    ;~ Call to removed due to offset issue $a_mpos = _ClientToScreen($appHandle, $client_mpos[0], $client_mpos[1]) ; $a_mpos now screen coords
    $a_mpos = $client_mpos
    $appHandle = GetHoveredHwnd($client_mpos[0], $client_mpos[1]) ; Uses the mouse to do the equivalent of WinGetHandle()

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(1, 0, 0)
    Local $a_wfp = DllCall("user32.dll", "hwnd", "WindowFromPoint", "long", $a_mpos[0], "long", $a_mpos[1]) ; gets the control handle
    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $t_class = DllStructCreate("char[260]")
    DllCall("User32.dll", "int", "GetClassName", "hwnd", $a_wfp[0], "ptr", DllStructGetPtr($t_class), "int", 260)
    Local $a_ret[5] = [$a_wfp[0], DllStructGetData($t_class, 1), $a_mpos[0], $a_mpos[1], "none"]
    Local $sClassNN = _ControlGetClassnameNN($a_ret[0]) ; optional, will run faster without it
    $a_ret[4] = $sClassNN

    [/autoit] [autoit][/autoit] [autoit]

    Return $a_ret
    EndFunc ;==>_Mouse_Control_GetInfo

    [/autoit] [autoit][/autoit] [autoit]

    ; ===============================================================================
    ; Retrieves the Handle of GUI/Application the mouse is over.
    ; Similar to WinGetHandle except it used the current mouse position
    ; Taken from <a href='http://www.autoitscript.com/forum/index.php?showtopic=444962' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showtopic=444962</a>
    ; Changed to take params to allow only one set of coords to be used.
    ; Params
    ;~ $i_xpos - x position of the mouse - usually from MouseGetPos(0)
    ;~ $i_ypos - x position of the mouse - usually from MouseGetPos(1)
    ; ===============================================================================
    Func GetHoveredHwnd($i_xpos, $i_ypos)
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", $i_xpos, "long", $i_ypos)
    If IsArray($iRet) Then
    $appHandle = $iRet[0]
    Return HWnd($iRet[0])
    Else
    Return SetError(1, 0, 0)
    EndIf
    EndFunc ;==>GetHoveredHwnd

    [/autoit] [autoit][/autoit] [autoit]

    ; ===============================================================================
    ;~ Gets the ClassNN of a control (Classname and Instance Count). This is checked with ControlGetHandle
    ;~ The instance is really a way to uniquely identify classes with the same name
    ;~ Big thanks to Valik for writing the function, taken from - <a href='http://www.autoitscript.com/forum/index.php?showtopic=97662' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showtopic=97662</a>
    ;~ Param
    ;~ $hControl - the control handle from which you want the ClassNN
    ;~ Returns
    ;~ the ClassNN of the given control

    [/autoit] [autoit][/autoit] [autoit]

    ; ===============================================================================
    Func _ControlGetClassnameNN($hControl)
    If Not IsHWnd($hControl) Then Return SetError(1, 0, "")
    Local Const $hParent = _WinAPI_GetAncestor($appHandle, $GA_ROOT) ; get the Window handle, this is set in GetHoveredHwnd()
    If Not $hParent Then Return SetError(2, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $sList = WinGetClassList($hParent) ; list of every class in the Window
    Local $aList = StringSplit(StringTrimRight($sList, 1), @LF, 2)
    _ArraySort($aList) ; improves speed
    Local $nInstance, $sLastClass, $sComposite

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($aList) - 1
    If $sLastClass <> $aList[$i] Then ; set up the first occurrence of a unique classname
    $sLastClass = $aList[$i]
    $nInstance = 1
    EndIf
    $sComposite = $sLastClass & $nInstance ;build the ClassNN for testing with ControlGetHandle. ClassNN = Class & ClassCount
    ;if ControlGetHandle(ClassNN) matches the given control return else look at the next instance of the classname
    If ControlGetHandle($hParent, "", $sComposite) = $hControl Then
    Return $sComposite
    EndIf
    $nInstance += 1 ; count the number of times the class name appears in the list
    Next
    Return SetError(3, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>_ControlGetClassnameNN

    [/autoit] [autoit][/autoit] [autoit]

    Func DoDropFiles($wnd, $Files)
    Local $tagStruct1, $dummy, $hGlobal, $pDropFiles, $DropFiles, $Size
    ;$wnd is the handle of the control we are dropping onto
    ;$Files is the list of files separated by "|"
    $tagStruct1 = "int offset;int px;int py;wchar fNC;wchar fWide"
    $dummy = DllStructCreate($tagStruct1)

    [/autoit] [autoit][/autoit] [autoit]

    ;grab some memory
    $hGlobal = _MemGlobalAlloc(DllStructGetSize($dummy) + StringLen($Files) + 2)
    ;DropFiles := GlobalLock(MemHandle)
    ;translates the memory handle to a pointer
    $pDropFiles = _MemGlobalLock($hGlobal)
    ;create the struct in this memory
    $DropFiles = DllStructCreate($tagStruct1 & ";char filelist[" & StringLen($Files) + 2 & "]", $pDropFiles)
    DllStructSetData($DropFiles, "offset", DllStructGetSize($dummy))
    $dummy = 0; done its job
    DllStructSetData($DropFiles, "px", 0);tried setting a point inside Notepad
    DllStructSetData($DropFiles, "py", 0);but it makes no difference
    DllStructSetData($DropFiles, "fwide", 0)
    DllStructSetData($DropFiles, "fNC", 0)
    DllStructSetData($DropFiles, "filelist", $Files)
    ;set the nulls in place of the separaters
    $Size = 0;
    $Files = StringSplit($Files, "|")
    For $I = 1 To $Files[0]

    [/autoit] [autoit][/autoit] [autoit]

    ;// number of characters per string (as ANSI) plus one #0 terminator
    ;Inc(Size, Length(Files[I]) + 1);
    $Size += StringLen($Files[$I]) + 1
    DllStructSetData($DropFiles, "filelist", 0, $Size)
    Next
    ;ConsoleWrite(DllStructGetData($DropFiles, "filelist") & @CRLF)
    ;now add the extra null to terminate the list of strings
    DllStructSetData($DropFiles, "filelist", 0, $Size + 1)
    _MemGlobalUnlock($hGlobal)
    _WinAPI_PostMessage($wnd, $WM_DROPFILES, $hGlobal, 0);
    ;// ... and finally release the memory

    [/autoit] [autoit][/autoit] [autoit]

    _MemGlobalFree($hGlobal)
    EndFunc ;==>DoDropFiles

    [/autoit] [autoit][/autoit] [autoit]

    Func _WinInfoFromPoint($nX, $nY);by Saio
    Local $tStrBuff, $pStrBuff, $aRet, $hWnd, $hOwnerWnd, $sClassName, $sOwnerClass, $sWinText
    $tStrBuff = DllStructCreate("char[100]")
    $pStrBuff = DllStructGetPtr($tStrBuff)
    $aRet = DllCall("user32.dll", "hwnd", "WindowFromPoint", "uint", $nX, "uint", $nY)
    $hWnd = $aRet[0]
    $aRet = DllCall("user32.dll", "int", "GetClassName", "hwnd", $hWnd, "ptr", $pStrBuff, "int", 100)
    $sClassName = DllStructGetData($tStrBuff, 1)
    DllStructSetData($tStrBuff, 1, "")
    DllCall("user32.dll", "int", "GetWindowText", "hwnd", $hWnd, "ptr", $pStrBuff, "int", 100)
    ;~ DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "uint", $WM_GETTEXT, "uint", 100, "ptr", $pStrBuff)
    $sWinText = DllStructGetData($tStrBuff, 1)
    DllStructSetData($tStrBuff, 1, "")
    $aRet = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hWnd, "uint", 2);$GA_ROOT = 2
    $hOwnerWnd = $aRet[0]
    $aRet = DllCall("user32.dll", "int", "GetClassName", "hwnd", $hOwnerWnd, "ptr", $pStrBuff, "int", 100)
    $sOwnerClass = DllStructGetData($tStrBuff, 1)
    DllStructSetData($tStrBuff, 1, "")

    [/autoit] [autoit][/autoit] [autoit]

    Local $Array[5] = [$sWinText, $sClassName, $hWnd, $sOwnerClass, $hOwnerWnd]

    [/autoit] [autoit][/autoit] [autoit]

    ;Window Text: $sWinText | $Array[0]
    ;ClassName: $sClassName | $Array[1]
    ;Window Handle: $hWnd | $Array[2]
    ;Owner ClassName: $sOwnerClass | $Array[3]
    ;Owner Handle: $hOwnerWnd | $Array[4]
    #cs
    ConsoleWrite(@CRLF & "{ WinInfo }" & @CRLF)
    ConsoleWrite("Window Text: " & $sWinText & @CRLF)
    ConsoleWrite("ClassName: " & $sClassName & @CRLF)
    ConsoleWrite("Window Handle: " & $hWnd & @CRLF)
    ConsoleWrite("Owner ClassName: " & $sOwnerClass & @CRLF)
    ConsoleWrite("Owner Handle: " & $hOwnerWnd & @CRLF)
    ConsoleWrite("{ WinInfo }" & @CRLF & @CRLF)
    #ce
    Return $Array

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>_WinInfoFromPoint

    [/autoit]

    Eingebunden wird dabei die "MouseOnEvent.au3":

    Spoiler anzeigen
    [autoit]

    #Region Header

    [/autoit] [autoit][/autoit] [autoit]

    #CS

    [/autoit] [autoit][/autoit] [autoit]

    Title: MouseOnEvent UDF
    Filename: MouseOnEvent.au3
    Description: Set an events handler (a hook) for Mouse device.
    Author: G.Sandler a.k.a (Mr)CreatoR (CreatoR's Lab - http://creator-lab.ucoz.ru, http://autoit-script.ru)
    Version: 1.9
    Requirements: AutoIt v3.3.6.1 +, Developed/Tested on Windows XP (rus) Service Pack 2/3, Win 7, with standard 3-buttons mouse device
    Uses: WindowsConstants.au3, WinAPI.au3, Timers.au3
    Forum Link: http://www.autoitscript.com/forum/index.php?showtopic=64738
    Notes:
    1) The original events-messages (such as $WM_MOUSEMOVE) can be used as well.
    2) Blocking $sFuncName function with commands such as "Msgbox()" can lead to unexpected behavior,
    the return to the system should be as fast as possible!
    3) When $MOUSE_PRIMARYDOWN_EVENT and $MOUSE_SECONDARYDOWN_EVENT are set,
    the $MOUSE_PRIMARYDBLCLK_EVENT and $MOUSE_SECONDARYDBLCLK_EVENT events are also set by force,
    to unset these events use _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT or $MOUSE_SECONDARYDBLCLK_EVENT).
    4) When using obfuscator, make sure to add event functions to ignore list (#Obfuscator_Ignore_Funcs).

    ChangLog:
    v1.9 [22.07.2012]
    * Script breaking version!
    * Dropped AutoIt 3.3.0.0 support.
    * Instead of $sParam1 and $sParam2, now $vParam used as last parameter.
    * Event function ($sFuncName) now called with $iEvent as first parameter, and $vParam as second (both optional).
    * Now $iBlockDefProc is set to -1 by default (event function can define whether to block event process or not, simply by returning 1 or 0).
    * Fixed not working $MOUSE_PRIMARYDBLCLK_EVENT and $MOUSE_SECONDARYDBLCLK_EVENT,
    now handled manually because windows does not always receive these events (depending on CS_DBLCLKS style).
    (not tested properly, so these events will have "experimental" label for now).
    * Fixed error related to "Subscript used with non-Array variable", caused when window with handle of $hTargetWnd parameter is not found (window closed).
    * Examples updated.

    v1.8 [02.06.2010]
    * Fixed an issue with wrong handling when $MOUSE_XBUTTONUP/DOWN_EVENT and few other events are set.
    * Fixed an issue when user attempts to set other function for the event that already have been set.
    Now the function and other parameters are replaced for the current event.
    * UDF file renamed (removed "Set" in the middle and "_UDF" at the end of the name).
    * Cosmetic changes in the UDF code.
    * Docs updated.

    v1.7 [14.10.2009]
    * Stability fixes. Thanks again to wraithdu.

    v1.6 [13.10.2009]
    * Fixed an issue with releasing the resources of mouse hook. Thanks to wraithdu.

    v1.5 [09.10.2009]
    + Added wheel button up/down *scrolling* event recognition.
    Thanks to JRowe (http://www.autoitscript.com/forum/index.php?showtopic=103362).
    * Fixed an issue with returning value from __MouseSetOnEvent_MainHandler - should call _WinAPI_CallNextHookEx before return.
    * Constants starting with MOUSE_EXTRABUTTON* renamed to MOUSE_XBUTTON*, as it should be in the first place.
    * Few examples updated.

    v1.4 [30.09.2009]
    + Added UDF header to the function.
    + Now the original events-messages (such as $WM_MOUSEMOVE) can be used as well.
    + Added missing events (althought i am not sure if they are still supported)
    $MOUSE_PRIMARYDBLCLK_EVENT - Primary mouse button double click.
    $MOUSE_SECONDARYDBLCLK_EVENT - Secondary mouse button double click.
    $MOUSE_WHEELDBLCLK_EVENT - Wheel mouse button double click.
    $MOUSE_EXTRABUTTONDBLCLK_EVENT - Side mouse button double click.

    * Changed global vars and internal functions names to be more unique.
    * Fixed variables declaration and misspelling.

    v1.3 [27.10.2008]
    * Added optional parameter $iBlockDefProc - Define wether the Mouse events handler will block the default processing or not (Default is 1, block).
    If this is -1, then user can Return from the event function to set processing operation (see the attached example «AutoDrag Window.au3»).

    v1.2 [05.04.2008]
    * Added: [Optional] parameter $hTargetWnd, if set, the OnEvent function will be called only on $hTargetWnd window, otherwise will be standard Event processing.
    Note: Can be a little(?) buggy when you mix different events.

    v1.1 [22.03.2008]
    * Fixed: Incorrect ReDim when remove event from the array, it was causing UDF to crash script with error.
    * Spell/Grammar corrections
    * Added: An example of _BlockMouseClicksInput().

    v1.0 [21.02.2008]
    * First public release.
    #CE

    [/autoit] [autoit][/autoit] [autoit]

    #include-once
    #include <WindowsConstants.au3>
    #include <WinAPI.au3>
    #include <Timers.au3>

    [/autoit] [autoit][/autoit] [autoit]

    OnAutoItExitRegister('__MouseSetOnEvent_OnExitFunc')

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion Header

    [/autoit] [autoit][/autoit] [autoit]

    #Region Global Constants and Variables

    [/autoit] [autoit][/autoit] [autoit]

    Global $a__MSOE_Events[1][1]
    Global $h__MSOE_MouseProc = -1
    Global $h__MSOE_MouseHook = -1
    Global $i__MSOE_EventReturn = 1
    Global $h__MSOE_Hook_Timer = 0
    Global $h__MSOE_PrmDblClk_Timer = 0
    Global $h__MSOE_ScnDblClk_Timer = 0
    Global $i__MSOE_PrmDblClk_Timer = 0
    Global $i__MSOE_ScnDblClk_Timer = 0
    Global $a__MSOE_PrmDblClk_LastMPos[2]
    Global $a__MSOE_ScnDblClk_LastMPos[2]
    Global $a__MSOE_DblClk_Data = __MouseSetOnEvent_GetDoubleClickData()

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion Global Constants and Variables

    [/autoit] [autoit][/autoit] [autoit]

    #Region Public Constants

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $MOUSE_MOVE_EVENT = 0x200 ;512 (WM_MOUSEMOVE) ; ==> Mouse moving.
    Global Const $MOUSE_PRIMARYDOWN_EVENT = 0x201 ;513 (WM_LBUTTONDOWN) ; ==> Primary mouse button down.
    Global Const $MOUSE_PRIMARYUP_EVENT = 0x202 ;514 (WM_LBUTTONUP) ; ==> Primary mouse button up.
    Global Const $MOUSE_PRIMARYDBLCLK_EVENT = 0x203 ;515 (WM_LBUTTONDBLCLK) ; ==> Primary mouse button double click.
    Global Const $MOUSE_SECONDARYDOWN_EVENT = 0x204 ;516 (WM_RBUTTONDOWN) ; ==> Secondary mouse button down.
    Global Const $MOUSE_SECONDARYUP_EVENT = 0x205 ;517 (WM_RBUTTONUP) ; ==> Secondary mouse button up.
    Global Const $MOUSE_SECONDARYDBLCLK_EVENT = 0x206 ;518 (WM_RBUTTONDBLCLK) ; ==> Secondary mouse button double click.
    Global Const $MOUSE_WHEELDOWN_EVENT = 0x207 ;519 (WM_MBUTTONDOWN) ; ==> Wheel mouse button pressed down.
    Global Const $MOUSE_WHEELUP_EVENT = 0x208 ;520 (WM_MBUTTONUP) ; ==> Wheel mouse button up.
    Global Const $MOUSE_WHEELDBLCLK_EVENT = 0x209 ;521 (WM_MBUTTONDBLCLK) ; ==> Wheel mouse button double click.
    Global Const $MOUSE_WHEELSCROLL_EVENT = 0x20A ;522 (WM_MOUSEWHEEL) ; ==> Wheel mouse scroll.
    Global Const $MOUSE_WHEELSCROLLDOWN_EVENT = 0x20A + 8 ;530 (WM_MOUSEWHEEL + 8) ; ==> Wheel mouse scroll Down.
    Global Const $MOUSE_WHEELSCROLLUP_EVENT = 0x20A + 16 ;538 (WM_MOUSEWHEEL + 16) ; ==> Wheel mouse scroll Up.
    Global Const $MOUSE_XBUTTONDOWN_EVENT = 0x20B ;523 (WM_XBUTTONDOWN) ; ==> Side mouse button down (usually navigating next/back buttons).
    Global Const $MOUSE_XBUTTONUP_EVENT = 0x20C ;524 (WM_XBUTTONUP) ; ==> Side mouse button up.
    Global Const $MOUSE_XBUTTONDBLCLK_EVENT = 0x20D ;525 (WM_XBUTTONDBLCLK) ; ==> Side mouse button double click.

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion Public Constants

    [/autoit] [autoit][/autoit] [autoit]

    #Region Public Functions

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================
    ; Name...........: _MouseSetOnEvent
    ; Description....: Set an events handler (a hook) for Mouse device.
    ; Syntax.........: _MouseSetOnEvent($iEvent, $sFuncName = "", $hTargetWnd = 0, $iBlockDefProc = -1, $vParam = "")
    ; Parameters.....: $iEvent - The event to set, here is the list of supported events:
    ; $MOUSE_MOVE_EVENT - Mouse moving.
    ; $MOUSE_PRIMARYDOWN_EVENT - Primary mouse button down.
    ; $MOUSE_PRIMARYUP_EVENT - Primary mouse button up.
    ; $MOUSE_PRIMARYDBLCLK_EVENT - Primary mouse button double click.
    ; $MOUSE_SECONDARYDOWN_EVENT - Secondary mouse button down.
    ; $MOUSE_SECONDARYUP_EVENT - Secondary mouse button up.
    ; $MOUSE_SECONDARYDBLCLK_EVENT - Secondary mouse button double click.
    ; $MOUSE_WHEELDOWN_EVENT - Wheel mouse button pressed down.
    ; $MOUSE_WHEELUP_EVENT - Wheel mouse button up.
    ; $MOUSE_WHEELDBLCLK_EVENT - Wheel mouse button double click.
    ; $MOUSE_WHEELSCROLL_EVENT - Wheel mouse scroll.
    ; $MOUSE_WHEELSCROLLDOWN_EVENT - Wheel mouse scroll *Down*.
    ; $MOUSE_WHEELSCROLLUP_EVENT - Wheel mouse scroll *Up*.
    ; $MOUSE_XBUTTONDOWN_EVENT - Side mouse button down (usualy navigating next/back buttons).
    ; $MOUSE_XBUTTONUP_EVENT - Side mouse button up.
    ; $MOUSE_XBUTTONDBLCLK_EVENT - Side mouse button double click.
    ;
    ; $sFuncName - [Optional] Function name to call when the event is triggered.
    ; If this parameter is empty string ("") or omited, the function will *unset* the $iEvent.
    ; $hTargetWnd - [Optional] Window handle to set the event for, e.g the event is set only for this window.
    ; $iBlockDefProc - [Optional] Defines if the event should be blocked (actualy block the mouse action).
    ; If this parameter = -1 (default), then event function can define whether to block event process or not, simply by returning 1 or 0.
    ; $vParam - [Optional] Parameter to pass to the event function ($sFuncName).
    ;
    ; Return values..: Success - If the event is set in the first time, or when the event is unset properly, the return is 1,
    ; if it's set on existing event, the return is 2.
    ; Failure - Returns 0 on UnSet event mode when there is no set events yet.
    ; Author.........: G.Sandler ((Mr)CreatoR, CreatoR's Lab - http://creator-lab.ucoz.ru, http://autoit-script.ru)
    ; Modified.......:
    ; Remarks........: 1) The original events-messages (such as $WM_MOUSEMOVE) can be used as well.
    ; 2) Blocking of $sFuncName function by window messages with commands
    ; such as "Msgbox()" can lead to unexpected behavior, the return to the system should be as fast as possible!
    ; Related........:
    ; Link...........: http://www.autoitscript.com/forum/index.php?showtopic=64738
    ; Example........: Yes.
    ; ===============================================================================================================
    Func _MouseSetOnEvent($iEvent, $sFuncName = "", $hTargetWnd = 0, $iBlockDefProc = -1, $vParam = "")
    If $sFuncName = "" Then ;Unset Event
    If $a__MSOE_Events[0][0] < 1 Then
    Return 0
    EndIf

    Local $aTmp_Mouse_Events[1][1] = [[0]]

    For $i = 1 To $a__MSOE_Events[0][0]
    If $a__MSOE_Events[$i][0] <> $iEvent Then
    $aTmp_Mouse_Events[0][0] += 1
    ReDim $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]+1][5]

    $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][0] = $a__MSOE_Events[$i][0]
    $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][1] = $a__MSOE_Events[$i][1]
    $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][2] = $a__MSOE_Events[$i][2]
    $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][3] = $a__MSOE_Events[$i][3]
    $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][4] = $a__MSOE_Events[$i][4]
    EndIf
    Next

    $a__MSOE_Events = $aTmp_Mouse_Events

    If $a__MSOE_Events[0][0] < 1 Then
    If $i__MSOE_EventReturn = 1 Then
    __MouseSetOnEvent_OnExitFunc()
    ElseIf $i__MSOE_EventReturn = 0 Then
    $h__MSOE_Hook_Timer = _Timer_SetTimer(0, 10, "__MouseSetOnEvent_WaitHookReturn")
    EndIf
    EndIf

    Return 1
    EndIf

    ;First event
    If $a__MSOE_Events[0][0] < 1 Then
    $h__MSOE_MouseProc = DllCallbackRegister("__MouseSetOnEvent_MainHandler", "int", "int;ptr;ptr")
    $h__MSOE_MouseHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($h__MSOE_MouseProc), _WinAPI_GetModuleHandle(0), 0)
    EndIf

    ;Search thru events, and if the event already set, we just (re)set the new function and other parameters
    For $i = 1 To $a__MSOE_Events[0][0]
    If $a__MSOE_Events[$i][0] = $iEvent Then
    $a__MSOE_Events[$i][0] = $iEvent
    $a__MSOE_Events[$i][1] = $sFuncName
    $a__MSOE_Events[$i][2] = $hTargetWnd
    $a__MSOE_Events[$i][3] = $iBlockDefProc
    $a__MSOE_Events[$i][4] = $vParam

    Return 2
    EndIf
    Next

    $a__MSOE_Events[0][0] += 1
    ReDim $a__MSOE_Events[$a__MSOE_Events[0][0]+1][5]

    $a__MSOE_Events[$a__MSOE_Events[0][0]][0] = $iEvent
    $a__MSOE_Events[$a__MSOE_Events[0][0]][1] = $sFuncName
    $a__MSOE_Events[$a__MSOE_Events[0][0]][2] = $hTargetWnd
    $a__MSOE_Events[$a__MSOE_Events[0][0]][3] = $iBlockDefProc
    $a__MSOE_Events[$a__MSOE_Events[0][0]][4] = $vParam

    ;Add primary/secondary double click event, if needed can be disabled later
    If $iEvent = $MOUSE_PRIMARYDOWN_EVENT Then
    _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, $sFuncName, $hTargetWnd, $iBlockDefProc, $vParam)
    EndIf

    If $iEvent = $MOUSE_SECONDARYDOWN_EVENT Then
    _MouseSetOnEvent($MOUSE_SECONDARYDBLCLK_EVENT, $sFuncName, $hTargetWnd, $iBlockDefProc, $vParam)
    EndIf

    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion Public Functions

    [/autoit] [autoit][/autoit] [autoit]

    #Region Internal Functions

    [/autoit] [autoit][/autoit] [autoit]

    Func __MouseSetOnEvent_MainHandler($nCode, $wParam, $lParam)
    If $nCode < 0 Then
    Return _WinAPI_CallNextHookEx($h__MSOE_MouseHook, $nCode, $wParam, $lParam) ;Continue processing
    EndIf

    Local $iEvent = _WinAPI_LoWord($wParam)
    Local $iRet
    Local $iBlockDefProc_Ret
    Local $iWScrollDirection = 0

    If $a__MSOE_Events[0][0] < 1 Then
    Return 0
    EndIf

    Switch $iEvent
    Case $MOUSE_WHEELSCROLL_EVENT
    Local Const $stMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo"
    Local $tWheel_Struct = DllStructCreate($stMSLLHOOKSTRUCT, $lParam)

    $iWScrollDirection = _WinAPI_HiWord(DllStructGetData($tWheel_Struct, 3))
    Case $MOUSE_PRIMARYDOWN_EVENT
    If $i__MSOE_PrmDblClk_Timer = 0 Then
    $i__MSOE_PrmDblClk_Timer = TimerInit()
    $a__MSOE_PrmDblClk_LastMPos = MouseGetPos()
    $h__MSOE_PrmDblClk_Timer = _Timer_SetTimer(0, $a__MSOE_DblClk_Data[0] + 50, '__MouseSetOnEvent_DoubleClickExpire')
    ElseIf $i__MSOE_PrmDblClk_Timer > 0 Then
    If TimerDiff($i__MSOE_PrmDblClk_Timer) <= $a__MSOE_DblClk_Data[0] Then
    Local $aCurrentMPos = MouseGetPos()

    Local $iDC_Width = $aCurrentMPos[0] - $a__MSOE_PrmDblClk_LastMPos[0]
    If $a__MSOE_PrmDblClk_LastMPos[0] > $aCurrentMPos[0] Then $iDC_Width = $a__MSOE_PrmDblClk_LastMPos[0] - $aCurrentMPos[0]

    Local $iDC_Height = $aCurrentMPos[1] - $a__MSOE_PrmDblClk_LastMPos[1]
    If $a__MSOE_PrmDblClk_LastMPos[1] > $aCurrentMPos[1] Then $iDC_Height = $a__MSOE_PrmDblClk_LastMPos[1] - $aCurrentMPos[1]

    If $iDC_Width <= $a__MSOE_DblClk_Data[1] And $iDC_Height <= $a__MSOE_DblClk_Data[2] Then
    $iEvent = $MOUSE_PRIMARYDBLCLK_EVENT
    EndIf
    EndIf

    $i__MSOE_PrmDblClk_Timer = 0
    EndIf
    Case $MOUSE_SECONDARYDOWN_EVENT
    If $i__MSOE_ScnDblClk_Timer = 0 Then
    $i__MSOE_ScnDblClk_Timer = TimerInit()
    $a__MSOE_ScnDblClk_LastMPos = MouseGetPos()
    $h__MSOE_ScnDblClk_Timer = _Timer_SetTimer(0, $a__MSOE_DblClk_Data[0] + 50, '__MouseSetOnEvent_DoubleClickExpire')
    ElseIf $i__MSOE_ScnDblClk_Timer > 0 Then
    If TimerDiff($i__MSOE_ScnDblClk_Timer) <= $a__MSOE_DblClk_Data[0] Then
    Local $aCurrentMPos = MouseGetPos()

    Local $iDC_Width = $aCurrentMPos[0] - $a__MSOE_ScnDblClk_LastMPos[0]
    If $a__MSOE_ScnDblClk_LastMPos[0] > $aCurrentMPos[0] Then $iDC_Width = $a__MSOE_ScnDblClk_LastMPos[0] - $aCurrentMPos[0]

    Local $iDC_Height = $aCurrentMPos[1] - $a__MSOE_ScnDblClk_LastMPos[1]
    If $a__MSOE_ScnDblClk_LastMPos[1] > $aCurrentMPos[1] Then $iDC_Height = $a__MSOE_ScnDblClk_LastMPos[1] - $aCurrentMPos[1]

    If $iDC_Width <= $a__MSOE_DblClk_Data[1] And $iDC_Height <= $a__MSOE_DblClk_Data[2] Then
    $iEvent = $MOUSE_SECONDARYDBLCLK_EVENT
    EndIf
    EndIf

    $i__MSOE_ScnDblClk_Timer = 0
    EndIf
    EndSwitch

    For $i = 1 To $a__MSOE_Events[0][0]
    If $a__MSOE_Events[$i][0] = $iEvent Or $iWScrollDirection <> 0 Then
    ;Handle wheel scroll up/down
    If $iEvent = $MOUSE_WHEELSCROLL_EVENT And ($a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLL_EVENT Or $a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLLUP_EVENT Or $a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLLDOWN_EVENT) Then
    If $iWScrollDirection > 0 And $a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLLUP_EVENT Then
    $iEvent = $MOUSE_WHEELSCROLLUP_EVENT
    ElseIf $iWScrollDirection < 0 And $a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLLDOWN_EVENT Then
    $iEvent = $MOUSE_WHEELSCROLLDOWN_EVENT
    ElseIf $a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLLUP_EVENT Or $a__MSOE_Events[$i][0] = $MOUSE_WHEELSCROLLDOWN_EVENT Then
    ContinueLoop
    EndIf
    ElseIf $iWScrollDirection <> 0 Then
    ContinueLoop
    EndIf

    If $a__MSOE_Events[$i][2] <> 0 And Not __MouseSetOnEvent_IsHoveredWnd($a__MSOE_Events[$i][2]) Then
    Return 0 ;Allow default processing
    EndIf

    $i__MSOE_EventReturn = 0
    $iBlockDefProc_Ret = $a__MSOE_Events[$i][3]

    $iRet = Call($a__MSOE_Events[$i][1], $iEvent, $a__MSOE_Events[$i][4])

    If @error Then
    $iRet = Call($a__MSOE_Events[$i][1], $iEvent)

    If @error Then
    $iRet = Call($a__MSOE_Events[$i][1])
    EndIf
    EndIf

    $i__MSOE_EventReturn = 1

    If $iBlockDefProc_Ret = -1 Then
    $iBlockDefProc_Ret = $iRet
    EndIf

    Return $iBlockDefProc_Ret ;Block default processing (or not :))
    EndIf
    Next

    Return _WinAPI_CallNextHookEx($h__MSOE_MouseHook, $nCode, $wParam, $lParam) ;Continue processing
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __MouseSetOnEvent_WaitHookReturn($hWnd, $iMsg, $iIDTimer, $dwTime)
    If $i__MSOE_EventReturn = 1 Then
    _Timer_KillTimer(0, $h__MSOE_Hook_Timer)
    __MouseSetOnEvent_OnExitFunc()
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __MouseSetOnEvent_IsHoveredWnd($hWnd)
    ;~ Local $iRet = False
    ;~
    ;~ Local $aWin_Pos = WinGetPos($hWnd)
    ;~ Local $aMouse_Pos = MouseGetPos()
    ;~
    ;~ If Not IsArray($aWin_Pos) Then
    ;~ Return SetError(1, 0, False)
    ;~ EndIf
    ;~
    ;~ If $aMouse_Pos[0] >= $aWin_Pos[0] And $aMouse_Pos[0] <= ($aWin_Pos[0] + $aWin_Pos[2]) And _
    ;~ $aMouse_Pos[1] >= $aWin_Pos[1] And $aMouse_Pos[1] <= ($aWin_Pos[1] + $aWin_Pos[3]) Then
    ;~ $iRet = True
    ;~ EndIf
    ;~
    ;~ Local $aRet = DllCall("User32.dll", "hwnd", "WindowFromPoint", "long", $aMouse_Pos[0], "long", $aMouse_Pos[1])
    ;~
    ;~ If HWnd($aRet[0]) <> $hWnd And Not $iRet Then
    ;~ $iRet = False
    ;~ EndIf

    Local $tPoint = _WinAPI_GetMousePos()
    Return _WinAPI_GetAncestor(_WinAPI_WindowFromPoint($tPoint), $GA_ROOT) = $hWnd
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __MouseSetOnEvent_DoubleClickExpire($hWnd, $iMsg, $iIDTimer, $dwTime)
    If TimerDiff($i__MSOE_PrmDblClk_Timer) > $a__MSOE_DblClk_Data[0] Then
    _Timer_KillTimer(0, $h__MSOE_PrmDblClk_Timer)
    $h__MSOE_PrmDblClk_Timer = 0
    $i__MSOE_PrmDblClk_Timer = 0
    EndIf

    If TimerDiff($i__MSOE_ScnDblClk_Timer) > $a__MSOE_DblClk_Data[0] Then
    _Timer_KillTimer(0, $h__MSOE_ScnDblClk_Timer)
    $h__MSOE_ScnDblClk_Timer = 0
    $i__MSOE_ScnDblClk_Timer = 0
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __MouseSetOnEvent_GetDoubleClickData()
    Local $aRet[3] = _
    [ _
    RegRead('HKEY_CURRENT_USER\Control Panel\Mouse', 'DoubleClickSpeed'), _
    RegRead('HKEY_CURRENT_USER\Control Panel\Mouse', 'DoubleClickWidth'), _
    RegRead('HKEY_CURRENT_USER\Control Panel\Mouse', 'DoubleClickHeight') _
    ]

    Local $aGDCT = DllCall('User32.dll', 'uint', 'GetDoubleClickTime')

    If Not @error And $aGDCT[0] > 0 Then
    $aRet[0] = $aGDCT[0]
    EndIf

    Return $aRet
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __MouseSetOnEvent_OnExitFunc()
    If $h__MSOE_MouseHook <> -1 Then
    _WinAPI_UnhookWindowsHookEx($h__MSOE_MouseHook)
    $h__MSOE_MouseHook = -1
    EndIf

    If $h__MSOE_MouseProc <> -1 Then
    DllCallbackFree($h__MSOE_MouseProc)
    $h__MSOE_MouseProc = -1
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    #EndRegion Internal Functions

    [/autoit]


    Mfg Kana

  • Tjo weder im Explorer noch mit Filezilla scheint das so zu klappen. Notepad und Word funktionieren hingegen einwandfrei. Von meiner Seite wird hier eher nichts mehr kommen, hab nun lange genug damit rumgespielt. Die Frage bleibt auch wozu man sowas braucht. Normalerweise kann man die meisten Programme sehr viel besser auf anderem Wege automatisieren oder eben auf besser automatisierbare Alternativen zurückgreifen. Drag and Drop würde jedenfalls niemals zu meiner ersten Wahl zählen.