Jump to content
Sign in to follow this  
crashdemons

Capture Screen DLL problem

Recommended Posts

crashdemons

captdll.dll post - http://www.autoitscript.com/forum/index.php?showtopic=8377

I wanted to use this DLL in a window-capture program I made..

The function works great but when running it, it seems to exit my code after saving the screenshot...

And If I compile the code into a program, it wants to toss errors.... let me know if im doing somethign wrong...

Nomatter whether it tosses an error or end abruptly it still manages to save the screenshot....

#NoTrayIcon
$window=InputBox("Window Capture", "Enter the name of the window to capture", "")
$findow=StringRegExpReplace($window,"[^a-z0-9A-Z]","_")
$finnam=FileSaveDialog( "Screenshot Save", "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "JPEG Images (*.jpg)", 2, $findow&"_Screenshot")
If @error Then
    MsgBox(0,"Warning","Window Capture cancelled.")
Else
If StringRegExp($finnam,"^.*\.(jpg|jpeg)",0)==0 Then $finnam &= ".jpg"
WinActivate($window)
$wincor=WinGetPos($window)
sleep(250)
DllCall("captdll.dll", "int", "CaptureRegion", "str", $finnam, "int", $wincor[0], "int", $wincor[1], "int", $wincor[2], "int", $wincor[3], "int", 85)
sleep(250)
MsgBox(0,"Success","Screenshot Saved."&@CRLF&$finnam)
EndIf
Exit

Line 0 (File "D:\project\Capture_window.exe"):

$retval=DllCall("captdll.dll", "int", "CaptureRegion", "str", $finnam, "int", $wincor[0], "int", $wincor[1], "int", $wincor[2], "int", $wincor[3], "int", 85)

Error: AutoIt has detected the stack has become corrupt.

Stack corruption typically occurs when either the wrong calling convention is used or when the function is called with the wrong number of arguments.

AutoIt supports the __stdcall (WINAPI) and __cdecl calling conventions. The __stdcall (WINAPI) convention is used by default but __cdecl can be used instead. See the DllCall() documentation for details on changing the calling convention.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites
crashdemons

I solved my own problem, sorry. :">

But for future reference since autoit uses stdcall it made the line

DllCall("captdll.dll", "int", "CaptureRegion", "str", $finnam, "int", $wincor[0], "int", $wincor[1], "int", $wincor[2], "int", $wincor[3], "int", 85)oÝ÷ Û
èhÁëÞ®Ø^{¦¦W¢ÉnuçpØmàË.벫¨¶)íªê-º`¶[Hj[(¶¸v«¨¶z'z«¨·brbv{p¢¹%¶[E¢±n¶êÞEçÞ­éÜ{­+

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites
pete_l

For Future Reference --->

This DID work :rolleyes:

DllCall("captdll.dll", "int:cdecl", "CaptureRegion][ÝË    ][ÝÜÝ][ÝË  ÌÍÙ[[K   ][ÝÚ[ ][ÝË  ÌÍÝÚ[ÛÜÌK    ]÷C¶çBgV÷C²Âb33c·væ6÷%³ÒÂgV÷C¶çBgV÷C²Âb33c·væ6÷%³%ÒÂgV÷C¶çBgÕ½Ðì°ÀÌØíÝ¥¹½ÉlÍt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°àÔ
Excellent work crashdemons, I just tripped the same problem

Share this post


Link to post
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
Sign in to follow this  

×