Function Reference


_ScreenCapture_Capture

Captures a region of the screen

#include <ScreenCapture.au3>
_ScreenCapture_Capture ( [$sFileName = "" [, $iLeft = 0 [, $iTop = 0 [, $iRight = -1 [, $iBottom = -1 [, $bCursor = True]]]]]] )

Parameters

$sFileName [optional] Full path and extension of the image file
$iLeft [optional] X coordinate of the upper left corner of the rectangle
$iTop [optional] Y coordinate of the upper left corner of the rectangle
$iRight [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used.
$iBottom [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used.
$bCursor [optional] If True the cursor will be captured with the image

Return Value

Success: a handle to an HBITMAP if $sFileName is empty,
or True If called with $sFileName and the image is successfully saved.
Failure: Set @error to non-zero.

Remarks

If a handle is returned, it must be released using _WinAPI_DeleteObject().

Related

_ScreenCapture_SaveImage, _WinAPI_DeleteObject

Example

#include <ScreenCapture.au3>

Example()

Func Example()
    ; Capture full screen
    _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg")

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image1.jpg")

    ; Capture region
    _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", 0, 0, 796, 596)

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image2.jpg")
EndFunc   ;==>Example