The GetBlock function copies a rectangular area of the screen to a specified buffer.
DS
Specifies the segment address of the grabber (CS and DS registers are equal).
ES:DI
Points to a GRABREQUEST structure defining the size and format of the block to capture. The structure has the following format:
GrabRequest struc
grlpData dd ? ;long pointer to I/O buffer
grXorg db ? ;x origin (unsigned)
grYorg db ? ;y origin (unsigned)
grXext db ? ;x extent (unsigned)
grYext db ? ;y extent (unsigned)
grStyle db ? ;style flags
grChar db ? ;character code for fill operations
grAttr db ? ;attribute for fill operations
GrabRequest ends
The return value is the number of bytes transferred and is set in the AX register if successful. The carry flag is cleared as well. Otherwise, the return value is one of the following error values.
Value | Meaning |
ERR_UNSUPPORTED (0FFh) | Block operation not supported. |
ERR_BOUNDARY (0FEh) | Source or destination range in error. |
If the grlpData member is NULL, GetBlock returns the number of bytes to copy without actually copying the bytes.
GetBlock uses only the Format value of the grStyle member. If the Format value in grStyle is FMT_NATIVE, GetBlock copies the data in the native screen format for the current video context. Thus, text screens result in character and attribute pairs being copied, while graphics screens result in a bitmap. Since the native format is screen dependent, use it for saving and restoring; don't attempt to interpret the data.
If the Format value is FMT_OTHER, GetBlock copies the data in a variant of the Windows clipboard format defined by the grabber-buffer structure, GRABST. This buffer has GT_TEXT type for text screens and GT_NEWBITMAP type for graphics screens.
GetBlock does not use the grChar and grAttr members.
In text mode, the display adapter may contain multiple character sets or allow downloadable character sets. The data returned in clipboard format will be translated to the standard OEM set if it can be determined that another set is in use, which character set it is, and whether or not a translation table is available for the job. The EGA is an example of an adapter that makes it hard to determine that a set has been downloaded and practically impossible to determine which one it is.