Screen and Window Information

Windows provides a great deal of information about the screen and the objects displayed on the screen, such as icons and windows. The NonClientMetrics class includes information about the window borders, but the Screen class contains properties and methods that work with the screen and icons.

Although the Screen class (SCREEN.CLS) exposes a large number of properties, they’re all quite simple. Each read-only property (see Table 9.20) provides a single piece of information about the screen, such as the width or height of the screen or the minimum height or width of a window. Table 9.20 also includes the single write-only property of the Screen object, the DeskWallPaper property. All the properties in this table except the DeskWallPaper property return long integers; you supply a string to the DeskWallPaper property indicating the wallpaper you’d like to use. Table 9.21 includes a list of the read/write properties supplied by the Screen object, including the datatype to specify for each property.

Table 9.22 lists the two methods of the Screen class. The GetWorkArea and SetWorkArea methods allow you to retrieve and set the work area Windows uses. That is, you can specify the coordinates used by a maximized window, if you’d like.

Table 9.20: Screen Class Read-Only Properties

Property Description
FullScreenX Width of the inside area of a full-screen window. Use GetWorkArea to get the portion of the screen not obscured by docked trays
FullScreenY Height of the inside area of a full-screen window. Use GetWorkArea to get the portion of the screen not obscured by docked trays
IconSizeX Default width, in pixels, for an icon
IconSizeY Default height, in pixels, for an icon
IconSpacingX Width, in pixels, of grid cells for items in Large Icon view
IconSpacingY Height, in pixels, of grid cells for items in Large Icon view
KanjiWindow For DBCS versions of Windows, height in pixels of the Kanji window
MaximizedX Width, in pixels, of a maximized top-level window
MaximizedY Height, in pixels, of a maximized top-level window
MaxTrackX Default maximum width, in pixels, of a window that has a caption and sizing borders
MaxTrackY Default maximum height, in pixels, of a window that has a caption and sizing borders
MenuCheckX Width, in pixels, of the default menu check-mark bitmap
MenuCheckY Height, in pixels, of the default menu check-mark bitmap
MinimizedX Width, in pixels, of a normal, minimized window
MinimizedY Height, in pixels, of a normal, minimized window
MinimumX Minimum width, in pixels, of a window
MinimumY Minimum height, in pixels, of a window
MinSpacingX Width, in pixels, of a grid cell for minimized windows
MinSpacingY Height, in pixels, of a grid cell for minimized windows
MinTrackX Minimum tracking width, in pixels, of a window
MinTrackY Minimum tracking height, in pixels, of a window
ScreenX Width of the screen, in pixels
ScreenY Height of the screen, in pixels
SmallIconX Recommended width for a small icon
SmallIconY Recommended height for a small icon
DeskWallPaper (Write-only) Sets desktop wallpaper. Supply a string containing a file name, or “(None)” to display no wallpaper. To get the wallpaper value, look in the Registry’s HKEY_CURRENT_USER\Control Panel\Desktop\WallPaper key

Table 9.21: Screen Class Read/Write Properties

Property Datatype Description
MinAnimation Boolean State of minimize animation. If False, Windows doesn’t display animation as you minimize a window. Setting this property to False makes Windows appear to run faster
DragFullWindows Boolean Determines whether dragging of full windows is enabled. If True, Windows displays the entire window contents as you move the window. If False, it displays only a border
FontSmoothing Boolean Indicates whether the font-smoothing feature is enabled
GridGranularity Long Granularity value of the desktop sizing grid. This granularity establishes how much control you have over the size of windows: the larger this setting, the fewer options you have
IconHorizontalSpacing Long Width of an icon cell
IconVerticalSpacing Long Height of an icon cell
IconTitleWrap Boolean Turns icon-title wrapping on or off
IconFontName String Font name for icons
IconFontSize Long Icon font size
MenuDropAlignment Boolean Alignment of pop-up menus. Specify True for right alignment and False for left alignment (the normal state)

Table 9.22: : Screen Class Methods

Method Description
GetWorkarea Gets the size of the work area. The work area is the portion of the screen not obscured by the taskbar
SetWorkArea Sets the size of the work area. The work area is the portion of the screen not obscured by the taskbar

© 1997 by SYBEX Inc. All rights reserved.