Get Command

Purpose

saves a portion of the screen in a string variable or a GDI bitmap.

Syntax

Get x1,y1,x2,y2, screensegment$

Get x1,y1,x2,y2, hbitmap

screensegment$:svar
hbitmap:Handle, ivar

Description

Get x1,y1,x2,y2, screensegment$ copies a portion of the screen with coordinates x1,y1 (upper left corner) and x2,y2 (lower right corner) to the string variable screensegment$.

Get x1,y1,x2,y2, hbitmap creates a device dependent bitmap with handle hbitmap.

Example

FullW 1

AutoRedraw = True

Local a$, a%, s%

BackColor = RGB(0, 255, 255)

ForeColor = RGB(255, 0, 0)

DefFill 5

PBox 10, 10, 100, 100

Get 10, 10, 100, 100, a$

FontTransparent = True

FontSize = 30

Text 20, 40, "Get"

Text 40, _Y - 300, "Please press key 'w'"

KeyGet s%

For a% = 1 To 700 Step 100

Put 100 + a%, 100, a$

Text 120 + a%, 140, "Put"

Text 40, _Y - 300, "Please press key 'w'"

KeyGet s%

Next

Cls

FontSize = 50 : FontBold = True

Text 20, _Y - 200, "End with Alt + F4"

Do : Sleep : Until Me Is Nothing

CloseW # 1

Draws a filled rectangle and copies a portion of this rectangle to a$. Using Put the rectangle is then returned to the window.

Remarks

The screen segments obtained with Get can be copied back to the screen by using Put.

When Get ,,,, hbitmap is used the bitmap must be released with FreeBmp; however, if that handle has been used to create a picture object by using CreatePicture, then the handle should not be freed until after you have finished with the picture object; otherwise, the handle which forms the source of the picture object will be destroyed and, thus, the picture will no longer be displayed.

GFA-BASIC 32 also supports the conversion of normal API bitmaps to an OLE Picture object with the CreatePicture function.

See Also

Put, FreeBmp, CreatePicture

{Created by Sjouke Hamstra; Last updated: 07/10/2014 by James Gaite}