SnapShot

Takes a bitmap snapshot of the screen and pastes it to the clipboard.

Syntax:

SnapShot (request#)

Parameters:

(i) request# see below.

Returns:

(i) always 0.

 

Request

Meaning

0 

Take snapshot of entire screen

1 

Take snapshot of client area of parent window of active window

2 

Take snapshot of entire area of parent window of active window

3

Take snapshot of client area of active window

4 

Take snapshot of entire area of active window

5 

Take snapshot of entire virtual screen (Windows 98+) On versions of Windows, that do not support virtual screens, this will be treated the same as request 0.

 

This function supports multi-monitor systems

 

Example:


;Takes a bitmap snapshot of the screen and pastes it to the clipboard.
Snapshot(0)
;returns the size of buffer needed for a subsequent BinaryAlloc,
;but doesn't attempt to place the contents of clipboard into a buffer
size=BinaryClipGet(0,8)
;allocates a data buffer
bb=BinaryAlloc(size)
;read file format type CF_DIB
BinaryClipGet(bb,8)
; need to add first 14 bytes to make it
; a BMP file format
bmpdatasize=14
bb2=BinaryAlloc(size + bmpdatasize)
;The characters identifying the bitmap.'BM'
BinaryPokeStr(bb2, 0, "BM")
;Complete file size in bytes.
BinaryPoke4(bb2,2,size + bmpdatasize)
;Reserved
BinaryPoke4(bb2,6,0)
;Data offset
headersize=BinaryPeek4(bb,0)
dataoffset = headersize + bmpdatasize
BinaryPoke4(bb2,10,dataoffset)
BinaryCopy(bb2,bmpdatasize,bb,0,size)
BinaryWrite(bb2,"c:\temp\screenshot.bmp")
BinaryFree(bb)
BinaryFree(bb2)
Message("All","Done")
See Also:

ClipPut