Capture part of the desktop to a .BMP

HardCopy function allows to take a screenshot of the entire screen or the active window.

If you need to take a screenshot of a part of the entire screen, whatever windows are within this portion, use this script below.

This script captures a portion of the desktop to a .BMP file.

You can find the corresponding script file under Script_Examples, sub-directory of scripts.

 

'Capture part of the desktop

'The image is saved to a .BMP file

'You must specify the coordinates of the rectangle to capture

'You can use the Display the mouse coordinates script to get these coordinates

 

UseWindow( "EXPLORER.EXE|SysListView32|Program Manager|1",1 )
res=CaptureBitmap( "C:\PROGRAM FILES\WINTASK\Scripts\desktop.bmp", InArea(0, 0, 100, 800) )

'display return code of CaptureBitmap function

msgbox(res)

'check the .BMP content

shell("pbrush "+chr$(34)+"C:\PROGRAM FILES\WINTASK\Scripts\desktop.bmp")