dll call version 3.1 --> 3.2.4.x FEHLER

  • Hi, ich hab hier nen Problem bei nem dll call

    Ich benutze die analizer.dll http://www.autoitscript.com/forum/index.php?showtopic=21629&hl=analizer.dll

    in nem alten projekt und nun brauch ich es mal wieder, hab aber mittlerweile ne neue Version von AutoIt drauf und krieg nen Fehler beim dll call, dass der stack corrupted wird und das es von nem falschen dll call herrührt.

    was muss ich ändern damit es wieder funzt?


    mfG Wanja

    Einmal editiert, zuletzt von Wanja (28. Juli 2007 um 09:51)

  • Weißt du was uns die Antwort erleichtern würde?

    a) Ein Krusty Burger
    b) Ein Krabbenburger
    c) Dein Sourcecode

    c!

    • Offizieller Beitrag

    Hallo,

    Ja, das liegt wahrscheinlich daran, das du ab Version 3.2.4.0 bei den meisten fällen ein DllOpen vor einem DllCall machen musst. Das sieht dann ungefähr so aus:

    Spoiler anzeigen
    [autoit]

    #include "analizer.au3"

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

    $DllOp = DllOpen('analizer.dll')
    opt("WinTitleMatchMode", 2)
    winwait("SciTE", "")
    winactivate("SciTE", "")
    AZPrintWindow()
    AZTextClick("Search")
    AZPrintWindow()
    AZTextClick("Find...")
    winwait("Find", "")
    winactivate("Find", "")
    send("Search")
    AZPrintWindow()
    AZTextClick("Find Next")
    DllClose($DllOp)

    [/autoit]

    Mfg Spider

  • Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    #include "array.au3"
    global $AZDLLName = "analizer.dll"

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

    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>analyser

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

    ;Find image on screen and return cords
    ;findFile: File you want to find on the screen
    ;rect: x,y,width,height
    ;first: 1 = find first 0 = find all
    Func _findImageOnScreen($findFile, $rect, $first)
    Dim $mouseCords[1][3]

    $rects = ""
    $trans = 0
    $color = ""

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

    $result = DllCall($AZDLLName, "int", "image_in_clipscreen_rects", "str", $findFile, "int", $first, "int", $trans, "str", $color, "str", $rect, "str", $rects)

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

    AZDllError("AZTextRects")
    $rects = $result[6]
    MsgBox(0,"",$rects)

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

    if $rects <> "" then
    $rects = stringright($rects, stringlen($rects) - 1)
    $rects = stringsplit($rects, ";")
    $mouseIndex = $rects[0]
    ReDim $mouseCords[$mouseIndex+1][3]
    else
    $rects = _arraycreate(0)
    endif

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

    if $rects[0] < 1 then
    return 0
    endif


    if ($rects[0] <> 0) then
    For $n = 1 to $mouseIndex
    ;MsgBox(0,$n,$rects[$n])
    $items = stringsplit($rects[$n], ",")
    if $items[0] = 4 then
    $mouseCords[$n][1] = $items[1] + $items[3] / 2
    $mouseCords[$n][2] = $items[2] + $items[4] / 2

    $pWidth = $items[3]
    $pHeight = $items[4]
    ElseIf $items[0] = 3 then
    $mouseCords[$n][1] = $items[1] + $pWidth / 2
    $mouseCords[$n][2] = $items[2] + $pHeight / 2
    Else
    AZTraceError("Index of the needed text rect out of bounds.")
    AZExit()
    Endif

    ;MsgBox(0,$mouseCords[$n][1],$mouseCords[$n][2])

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

    Next
    else
    $items = _arraycreate(0)
    endif

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

    return $mouseCords
    EndFunc

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

    ; Print window to clipboard (don't ALT PRINTSCREEN)
    func AZPrintWindow()
    $result = DllCall($AZDLLName, "none", "active_window_to_clip")
    AZDllError("AZPrintWindow")
    endfunc

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

    ;Error
    func AZDllError($func)
    if @error <> 0 then AZTraceError("'" & $func & "' function run error")
    endfunc

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

    ; Tracing error
    func AZTraceError($error)
    MsgBox(16, "Analizer error.", $error)
    endfunc

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

    ; Exit from script
    func AZExit()
    exit(1)
    endfunc

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

    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ANALYZER END

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

    Func FindPicture($picture)

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

    AZPrintWindow()
    $var = _findImageOnScreen($picture, "0,0,0,0", 0)

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

    If $var <> 0 Then
    For $r = 1 to UBound($var)-1
    MouseMove($var[$r][1] , $var[$r][2], 0 )
    Sleep(200)
    Next
    EndIf

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

    Endfunc

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

    sleep(10000)

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

    FindPicture("test.bmp")

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


    also ich habs auch nochma mit

    [autoit]


    $DllOp = DllOpen('analizer.dll')
    $result = DllCall($DllOp, "int", "image_in_clipscreen_rects", "str", $findFile, "int", $first, "int", $trans, "str", $color, "str", $rect, "str", $rects)
    DllClose($DllOp)

    [/autoit]

    und

    [autoit]


    $DllOp = DllOpen('analizer.dll')
    $result = DllCall($DllOp, "int:cdecl", "image_in_clipscreen_rects", "str", $findFile, "int", $first, "int", $trans, "str", $color, "str", $rect, "str", $rects)
    DllClose($DllOp)

    [/autoit]

    probiert,... krieg aber immernoch den Fehler ><

    help pls T.T

    Edit BugFix: Bitte Spoiler nutzen

    2 Mal editiert, zuletzt von Wanja (29. Juli 2007 um 01:52)

  • Ja, die Antwort steht doch schon da:
    See the DllCall() documentation for details on changing the calling convention.

    Bin mir nicht sicher, aber hat sich seit Version 3.2.4.0 nicht auch die Syntax der DllCall()-Funktion verändert? Überprüf das doch einfach mal! Und wie gtaspider schon anmerkte, am Besten immer DllOpen() vorher machen.

  • Zitat

    Original von teh_hahn
    Ja, die Antwort steht doch schon da:
    See the DllCall() documentation for details on changing the calling convention.

    Bin mir nicht sicher, aber hat sich seit Version 3.2.4.0 nicht auch die Syntax der DllCall()-Funktion verändert? Überprüf das doch einfach mal! Und wie gtaspider schon anmerkte, am Besten immer DllOpen() vorher machen.

    Das mit DllOpen hab ich ja schon probiert wie oben bereits erwähnt und es geht nicht...

    Ich hab ja schon alles mögliche probiert und weis keinen Rat mehr darum frag ich ja hier im Forum ><

  • Hast du auch geguckt, was sich beim DLLCall verändert hat in der neuen Version ?

  • Schreib mal bei dem Rückgabewert-Typ mal nur "int" statt "int:cdecl".

    Der Grund ist das die cdecl-Funktionalität erst seit Version 3.2.0 existiert - die Einstellung für diese Aufrufkonvention wurde also in früheren Versionen von AutoIt komplett ignoriert und es wurde, trotz deines Parameters, in der alten Version stdcall statt cdecl verwendet.

    Einmal editiert, zuletzt von AspirinJunkie (30. Juli 2007 um 01:12)

  • jo auch schon probiert, geht auch nicht kommt immer der gleiche Fehler
    im englishen Forum weis auch niemand Rat T.T

  • Hallo,

    ich habe heute das Screenshot-Beispiel von Screenshot.exe

    benutzen wollen und bekomme auch diese Fehlermeldung.

    Wurde das Script den neuen Anforderungen noch nicht angepasst?

    Ich habe mal folgenden Hinweis bekommen:

    Zitat

    Ist ein AutoIt-Update afaik. Die DLLCalls wurden geändert und man muss als Parameter noch angeben, dass man im Standardformat called (müsste die Fehlermeldung auch aussagen).

    peethebee

    Aber was ich konkret machen muss, habe ich noch nicht rausgefunden.....

    Vielleicht weiß doch inzwischen jemand zu helfen?

    Nachtrag:

    [autoit]


    ;Das funktioniert NICHT:
    $result = DllCall("captdll.dll", "int", "CaptureRegion", "str", $CaptureDirectory & $CaptureFile, "int", $Cwin2[0], "int", $Cwin2[1], "int", $Cwin2[2], "int", $Cwin2[3], "int", $Quality)

    ; das funktioniert:
    $result = DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)

    [/autoit]

    Einen Unterschied in den Parametern bzw. in deren Anzahl kann ich nicht finden.....

    Nachtrag 2:
    Es klappt weder mit Stabil: 3.2.4.9 (Q, H)
    noch mit Beta: 3.2.5.7 (Q, H)

    Vielen Dank,
    viele Grüße
    Carsten

    2 Mal editiert, zuletzt von Carsten (22. August 2007 um 22:47)

  • HY @ ALL


    Habe das gleiche Problem


    Will einen Paralellport ansprechen.


    Mit :


    DllCall("InpOut32.dll","short","Out32","short",0x378,"short",1,"short",1)

    ;Befehl("name_der_dll.dll","rückgabe_art","Ausführbefehl","rückgabe_art",adresse_des_paralellport,"rückgabe_art",port,"rückgabe_art",zustand)


    funktioniert wunder bar in V 3.1


    ab 3.2 kommt ein AUTOIT FEHLER!!!

    mit der üblichen Fehlerberichtsendeaufforderung an Microsoft Windows.


    kann mir irgend jemand Helfen, wie den oben genanten Befehl auch unter 3.2 und höher zum laufen bekomm?


    Danke im vorraus !!!


    Mit freundlichen Grüßen

    vivus

  • BITTESCHÖN!!

    Zum lesen:

    [autoit]


    $DLL = DLLOpen("inpout32.dll")

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

    $BCD1 = DllCall( $DLL, "short", "Inp32", "short", $ParallelPort1) ;Data-Register1

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

    $BCD2 = DllCall( $DLL, "short", "Inp32", "short", $ParallelPort1+1) ;Status-Register1

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

    $BCD3 = DllCall( $DLL, "short", "Inp32", "short", $ParallelPort1+2) ;Control-Register1

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

    Der Return von diesem Call ist ein ARRAY !

    Zum Schreiben:

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

    $DLL = DLLOpen("inpout32.dll")

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

    DllCall( $DLL, "int", "Out32", "int", $ParallelPort1, "int", $BCD) ;Data-Register

    [/autoit]


    Wobei ich bei $ParallelPort immer den DezimalWert der Adresse verwende - so ist es einfacher die nächsthöhere Adresse anzusprechen.

    bei mir: Basisadresse = 888 ( Data-Register ) ( = 0x378 in hex )
    Statusregister = 889
    Controlregister = 890

    ... wasweisichdennschon...

  • Leichenschänder :D Das ist jezt schon fast 2 Jahre her
    *duck*

    //Edit: ich glaub, du hast den falschen Thread erwischt.