Home > Language Reference > Capture Functions > CaptureBitmap

CaptureBitmap

The CaptureBitmap function captures a window or a portion of a window screen to a .BMP (bitmap) file.

Usage

Used to test if a window is the expected one.

Syntax

ret=CaptureBitmap(<bitmap_file> [,InArea (<x>, <y>, <height>, <width>)])

Parameters

<bitmap_file>, string, name of the file (extension .BMP) into which the captured bitmap is saved.

InArea, optional keyword to specify that the capture must be done within the specified area of the window.

<x>,<y>, integer, coordinates of the topleft point of the area.

<height>,<width>, integer, size of the area.

Return value

If the function succeeds, the return value is 0. If it fails, the return value is 1. If no UseWindow statement specifies the window name where the CaptureBitmap must be done, the return value is 1 but script execution does not stop.

Remarks

Generate the CaptureBitmap syntax using its wizard: in the Language pane of the WinTask Editor, double-click the CaptureBitmap function name to start the wizard (if the Language pane is not displayed, press F4 or select Insert/Statement menu).

See also

Capture$
CaptureArea$
CaptureAreaOCR$
CaptureOCR$
HardCopy

Examples

UseWindow( "NOTEPAD.EXE|Edit|Untitled - NotePad|1",1 )
CaptureBitmap("C:\wttest\image.bmp") 'captures the entire active window - note that the UseWindow before is compulsory.

CaptureBitmap("C:\wttest\image.bmp",InArea(10,10,100,200)) 'captures only the specified area