Screen Object

Purpose

Returns information about the desktop and other OS settings.

Syntax

Screen

Description

Screen retrieves various system metrics (widths and heights of display elements) and system configuration settings. Most of the properties conform to the GetSystemMetrics API function or its GFA-BASIC 32 counterpart SysMetric(). However, these functions return all values in pixels, where the Screen object returns some properties in Twips. In addition, there are quite some properties and methods (GetDC, Fonts) not found with the SysMetric function.

Arrange Integer Specifies how the system arranged minimized windows
CleanBoot Integer Specifies how the system was started: 0 Normal boot, 1 Fail-safe boot, 2 Fail-safe with network boot
cMetrics Integer Number value for the parameter GetSystemMetrics
cMouseButtons Integer Number of buttons on mouse (2,3 or 0)
cxBorder, cyBorder Integer Width and height, in pixels, of a window border.
cxCursor, cyCursor Integer Width and height, in pixels, of a cursor.
cxDlgFrame, cyDlgFrame Integer Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable.
cxDoubleClk, cyDoubleClk Integer Width and height, in pixels, of the rectangle around the location of a first click in a double-click sequence. The second click must occur within this rectangle for the system to consider the two clicks a double-click.
cxDrag, cyDrag Integer Width and height, in pixels, of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.
cxEdge, cyEdge Integer Dimensions, in pixels, of a 3-D border.
cxFixedFrame, cyFixedFrame Integer Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable.
cxFrame, cyFrame Integer Thickness, in pixels, of the sizing border around the perimeter of a window that can be resized.
cxFullScreen, cyFullScreen Integer Width and height of the client area for a full-screen
cxHScroll, cyHScroll Integer Width, in pixels, of the arrow bitmap on a horizontal scroll bar; and height, in pixels, of a horizontal scroll bar.
cxHThumb, cyVThumb Integer Width, in pixels, of the thumb box in a horizontal and vertical scroll bar.
cxIcon, cyIcon Integer The default width and height, in pixels, of an icon.
cxIconSpacing, cyIconSpacing Integer Dimensions, in pixels, of a grid cell for items in large icon view.
cxsmIcon, cysmIcon Integer Recommended dimensions, in pixels, of a small icon. Small icons typically appear in window captions and in small icon view.
cxMaximized, cyMaximized Integer Default dimensions, in pixels, of a maximized top-level window on the primary display monitor.
cxMaxTrack, cyMaxTrack Integer Default maximum dimensions, in pixels, of a window that has a caption and sizing borders.
cxMenuCheck, cyMenuCheck Integer Dimensions of the default menu check-mark bitmap, in pixels.
cxMenuSize, cyMenuSize Integer Dimensions of menu bar buttons
cxMin, cyMin Integer Minimum width and height of a window, in pixels.
cxMinimized, cyMinimized Integer Dimensions of a minimized window, in pixels
cxMinSpacing, cyMinSpacing Integer Dimensions of a grid cell for a minimized window, in pixels.
cxMinTrack, cyMinTrack Integer Minimum tracking width and height (size) of a window, in pixels.
cxScreen, cyScreen Integer Width and height, in pixels, of the screen of the primary display monitor (same as x, y).
cxSize, cySize Integer Width and height of a button in a window's caption or title bar, in pixels.
cxSizeFrame, cySizeFrame Integer Thickness, in pixels, of the sizing border around the perimeter of a window that can be resized.
cxsmSize, cysmSize Integer Dimensions, in pixels, of small caption buttons.
cxVScroll, cyVScroll Integer Width, in pixels, of a vertical scroll bar; and height, in pixels, of the arrow bitmap on a vertical scroll bar.
cyCaption Integer The height of the standard window caption in pixels.
cyKanjiWindow Integer For double-byte character set versions of the system, this is the height, in pixels, of the Kanji window at the bottom of the screen.
CommCtlVersion Double DLL version number of CommCtl.dll
dbcsEnabled Boolean TRUE if User32.dll supports DBCS
DEBUG Boolean TRUE if the debug version of User.exe is installed
FontCount Integer Number of installed fonts
Fonts String Name of installed fonts, i = 0 to Screen.FontCount -1
GetDC, ReleaseDC Integer Returns and releases DC of desktop window. Call ReleaseDC when ready.
Height, Width Integer Width and height, in Twips (OCX compatible), of the screen of the primary display monitor.
HimetsPerTwip, TwipsPerHimet Double Conversion factor for Himets to twips.
hWnd Integer Desktop window handle
MenuDropAlignment Boolean TRUE if drop-down menus are right-aligned
MidEastEnabled Boolean TRUE if the system is enabled for Hebrew and Arabic languages.
MouseCursor Object Sets and returns a MouseCursor object.
MouseIcon Object Sets and returns a MouseIcon object
MousePointer Integer Sets and returns the mouse to use.
MousePresent Boolean True if mouse is present
MouseX, MouseY Integer Mouse screen x, y position in pixels
MouseK Integer Mouse button state (1 = left, 2 = right, 4 = middle)
Network Integer Least significant bit is set if a network is present; otherwise, it is cleared.
PenWindows Boolean TRUE the Microsoft Windows for Pen computing extensions are installed.
PixelsPerTwipX, PixelsPerTwipY Double Conversion factor for pixels to twips.
Secure Boolean TRUE if security is present.
ShellVersion Double DLL version number of Shell32.dll
ShiftKeys Integer Shift, Ctrl, and Alt status. Returns a bit mask meaning
   0 - 0x000001 - Shift
   1 - 0x000001 - Control
   2 - 0x000001 - Alt
   3 - 0x000001 - Caps Lock
   4 - 0x000020 - Windows key left
   5 - 0x000020 - Windows key right
   6 - 0x000040 - Menu
   8 - 0x000100 - Shift left
   9 - 0x000200 - Control left
   10 - 0x000400 - Alt left
   12 - 0x001000 - Shift right
   13 - 0x002000 - Control Right
   14 - 0x004000 - Alt right
   16 - 0x010000 - Insert active
   17 - 0x020000 - Num Lock active
   18 - 0x040000 - Scroll Lock active
   19 - 0x080000 - Alt active
   20 - 0x100000 - Windows key left active
   21 - 0x200000 - Windows key right active
   22 - 0x400000 - Application key active
ShowSounds Boolean TRUE to present information visually in situations where it would otherwise present the information only in audible form.
SlowMachine Boolean TRUE if the computer has a low-end (slow) processor.
SwapButton Boolean Buttons swapped?
TwipsPerPixelX, TwipsPerPixelY Double Conversion factor for twips to pixels.
WinVer String String containing Windows version
WorkLeft, WorkTop, WorkWidth , WorkHeight Integer Screen work area in pixels. (When Me = Nothing, _X and _Y return WorkWidth and WorkHeight respectively.)
x, y Integer Width and height, in pixels, of the screen of the primary display monitor (same as cxScreen, cyScreen).

Event

Screen_KeyPreview

Example

Screen.ShiftKeys

PrintScroll = 1

SetFont SYSTEM_FIXED_FONT

Local i%

Do

i = Screen.ShiftKeys

Print Bin$(i, 23); " ";

If Btst(i, 0) Then Print "Shift ";

If Btst(i, 1) Then Print "Control ";

If Btst(i, 2) Then Print "Alt+ ";

If Btst(i, 3) Then Print "CapsLock ";

If Btst(i, 4) Then Print "LWin+ ";

If Btst(i, 5) Then Print "RWin+ ";

If Btst(i, 6) Then Print "Appl+ ";

If Btst(i, 8) Then Print "LShift ";

If Btst(i, 9) Then Print "LControl ";

If Btst(i, 10) Then Print "LAlt ";

If Btst(i, 12) Then Print "RShift ";

If Btst(i, 13) Then Print "RControl ";

If Btst(i, 14) Then Print "RAlt ";

If Btst(i, 16) Then Print "Insert* ";

If Btst(i, 17) Then Print "NumLock* ";

If Btst(i, 18) Then Print "ScrollLock* ";

If Btst(i, 19) Then Print "Alt* ";

If Btst(i, 20) Then Print "LWin* ";

If Btst(i, 21) Then Print "RWin* ";

If Btst(i, 22) Then Print "Appl* ";

Print

DoEvents

Loop Until Me Is Nothing

Remarks

An application should use GetWorkArea rather than the Screen properties WorkLeft, WorkTop, WorkWidth, and WorkHeight; these properties return values for the primary monitor only, not necessarily the monitor on which the application is running.

See Also

MouseCursor, MouseIcon, MousePointer, GetWorkArea, WinVer (function).

{Created by Sjouke Hamstra; Last updated: 09/05/2020 by James Gaite}