Jump to content

Error while DllCalling


Recommended Posts

Hi everyone, I encountered this error when I was calling dll to take screenshot. It's for taking screenshot from MapleStory because mine is messed up.

Code:

#include<GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)
Opt("TrayMenuMode", 3)
Opt("GUICloseOnEsc", 0)
Global $i = 0
FileInstall("\Capture.dll",@TempDir,0)
$gui = GUICreate("MapleStory Helper", 215, 75, -1, -1, -1)
$button = GUICtrlCreateButton("Take Screenshot", 5, 5, 100, 30)
$button0 = GUICtrlCreateButton("Minimize MS", 110, 5, 100, 30)
$button2 = GUICtrlCreateButton("Close MapleStory", 5, 40, 205, 30)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlSetOnEvent($button, "_Screenshot")
GUICtrlSetOnEvent($button0, "_Minimize")
GUICtrlSetOnEvent($button2, "_Close")
GUISetFont(9, 400, 0, "Tahoma")
GUICtrlSetFont($button, 9, 400, 0, "Tahoma")
GUICtrlSetFont($button0, 9, 400, 0, "Tahoma")
GUICtrlSetFont($button2, 9, 400, 0, "Tahoma")
GUISetState()
While 1
    Sleep(1000)
WEnd
Func Quit()
    Exit
EndFunc   ;==>Quit
Func _Minimize()
    Local $state = WinSetState("MapleStory", "", @SW_MINIMIZE)
    If $state = 0 Then
        _ToolTip()
        Return
    EndIf
EndFunc   ;==>_Minimize
Func _Close()
    Local $Close = WinClose("MapleStory", "")
    If $Close = 0 Then
        _ToolTip()
        Return
    EndIf
EndFunc   ;==>_Close
Func _Screenshot()
    Local $size = WinGetPos("MapleStory", "")
    If $size = 0 Then
        _ToolTip()
        Return
    EndIf
    DllCall(@TempDir & "\Capture.dll", "int", "CaptureRegion", "str", "MapleStory - " & $i & ".jpg", "int", $size[0], "int", $size[1], "int", $size[2], "int", $size[3], "int", 85)
    $i = $i + 1
EndFunc   ;==>_Screenshot
Func _ToolTip()
    ToolTip("MapleStory was not found", Default, Default, "MapleStory Helper", 1, 1)
    Sleep(800)
    ToolTip("")
EndFunc   ;==>_ToolTip
oÝ÷ ØGb´]¡ë-jGr·Èhµ»­Ü׫®ëmiû^­8b²+ìZ^r^¶­q©Â+a¶X¢}ý¶Çj|­)àº'­+ZºÚ"µÍÈØH[ØÜY[ÈÝ[Y]H[[[YKÝHYÈ]X[]KØ[
    ][ÝÐØK   ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÐØTØÜY[][ÝË   ][ÝÜÝ][ÝË  ][ÝÙ[Ù[É][ÝË  ][ÝÚ[ ][ÝË
JBÈØHÚ][YÚ[ÛÈÝ[Y]H[[[YK^ÝYÜÚYZYÚÝÛHHYÈ]X[]KÈÙ]]X[]HÈ[HYØ]]H[XÈØH[ÈTØ[
    ][ÝÐØK   ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÐØTYÚ[Û][ÝË   ][ÝÜÝ][ÝË  ][ÝÙ[ÜX[ ][ÝË  ][ÝÚ[ ][ÝËL ][ÝÚ[ ][ÝËL ][ÝÚ[ ][ÝËÌ    ][ÝÚ[ ][ÝË  ][ÝÚ[ ][ÝËLJB

Here is the dll and the screenshot of error.

Edited by Generator
Link to comment
Share on other sites

Maybe....

#include<GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 3)
Opt("TrayMenuMode", 3)
Opt("GUICloseOnEsc", 0)
Global $i = 0
Global $Title = "MapleStory"
FileInstall("\Capture.dll", @TempDir, 0)
$gui = GUICreate("MapleStory Helper", 215, 75, -1, -1, -1)
$button = GUICtrlCreateButton("Take Screenshot", 5, 5, 100, 30)
$button0 = GUICtrlCreateButton("Minimize MS", 110, 5, 100, 30)
$button2 = GUICtrlCreateButton("Close MapleStory", 5, 40, 205, 30)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUICtrlSetOnEvent($button, "_Screenshot")
GUICtrlSetOnEvent($button0, "_Minimize")
GUICtrlSetOnEvent($button2, "_Close")
GUISetFont(9, 400, 0, "Tahoma")
GUICtrlSetFont($button, 9, 400, 0, "Tahoma")
GUICtrlSetFont($button0, 9, 400, 0, "Tahoma")
GUICtrlSetFont($button2, 9, 400, 0, "Tahoma")
GUISetState()
While 1
    Sleep(1000)
WEnd
Func Quit()
    Exit
EndFunc   ;==>Quit
Func _Minimize()
    Local $state = WinSetState($Title, "", @SW_MINIMIZE)
    If $state = 0 Then
        _ToolTip()
        Return
    EndIf
EndFunc   ;==>_Minimize
Func _Close()
    Local $Close = WinClose($Title, "")
    If $Close = 0 Then
        _ToolTip()
        Return
    EndIf
EndFunc   ;==>_Close
Func _Screenshot()
    Local $size = WinGetPos($Title, "")
    If $size = 0 Then
        _ToolTip()
        Return
    EndIf
    If IsArray($size) Then DllCall(@TempDir & "\Capture.dll", "int", "CaptureRegion", "str", "MapleStory - " & $i & ".bmp", "int", $size[0], "int", $size[1], "int", $size[2], "int", $size[3], "int", -1)
    ; JPG = If IsArray($size) Then DllCall(@TempDir & "\Capture.dll", "int", "CaptureRegion", "str", "MapleStory - " & $i & ".jpg", "int", $size[0], "int", $size[1], "int", $size[2], "int", $size[3], "int", 85)
    $i = $i + 1
EndFunc   ;==>_Screenshot
Func _ToolTip()
    ToolTip("MapleStory was not found", Default, Default, "MapleStory Helper", 1, 1)
    Sleep(800)
    ToolTip("")
EndFunc   ;==>_ToolTip

8)

NEWHeader1.png

Link to comment
Share on other sites

Change:

DllCall(@TempDir & "\Capture.dll", "int", "CaptureRegion", "str", "MapleStory - " & $i & ".jpg", "int", $size[0], "int", $size[1], "int", $size[2], "int", $size[3], "int", 85)oÝ÷ Ù:ºÚ"µÍØ[
[   [È ][ÝÉÌLÐØK  ][ÝË  ][ÝÚ[ÙXÛ    ][ÝË  ][ÝÐØTYÚ[Û][ÝË   ][ÝÜÝ][ÝË  ][ÝÓXTÝÜHH  ][ÝÈ  [È ÌÍÚH [È ][ÝËÉ][ÝË  ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌK   ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌWK  ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌK   ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌ×K ][ÝÚ[ ][ÝË
J

- The Kandie Man ;-)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Change:

DllCall(@TempDir & "\Capture.dll", "int", "CaptureRegion", "str", "MapleStory - " & $i & ".jpg", "int", $size[0], "int", $size[1], "int", $size[2], "int", $size[3], "int", 85)oÝ÷ Ù:ºÚ"µÍØ[
[   [È ][ÝÉÌLÐØK  ][ÝË  ][ÝÚ[ÙXÛ    ][ÝË  ][ÝÐØTYÚ[Û][ÝË   ][ÝÜÝ][ÝË  ][ÝÓXTÝÜHH  ][ÝÈ  [È ÌÍÚH [È ][ÝËÉ][ÝË  ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌK   ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌWK  ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌK   ][ÝÚ[ ][ÝË  ÌÍÜÚ^VÌ×K ][ÝÚ[ ][ÝË
J

- The Kandie Man ;-)

Thanks, it worked.

Mind explaining why? :)

Link to comment
Share on other sites

This is because the newer version of AutoIt crashes when the assumed STD call fails. The dll isn't using STD, it is using C declared, CDECL. This is why it fails.

- The Kandie Man ;-)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...