SetScreenAttributes

Sets the display attribute bytes for the current screen

Local Servers:nonblocking
Remote Servers:N/A
Classification:4.x, 5.x, 6.x
Service:Screen Handling

Syntax

  #include <nwconio.h>  
   
  int SetScreenAttributes (  
     LONG   mask,
     LONG   attr); 
  

Parameters

mask

(IN) Specifies the attributes you want to set or clear:

Value

Bit

Name

Description

0x01

Bit 1

DONT_AUTO_ACTIVATE

Avoids autoactivation when screens are created, but no other screens exist.

0x02

Bit 2

DONT_SWITCH_SCREEN

Avoids screen being switched. Converted to _NON_SWITCHABLE_SCREEN.

0x10

Bit 4

DONT_CHECK_CTRL_CHARS

Turns off ^C and ^S processing.

0x20

Bit 5

AUTO_DESTROY_SCREEN

Avoids "Press any key to close screen."

0x80

Bit 7

UNCOUPLED_CURSORS

Displays distinct input and output cursors.

attr

(IN) Specifies the attributes to set, using the same values as the mask parameter. To set an attribute, it must be specified in both the mask and attr parameters. To clear an attribute, it must be specified in only the mask paramter.

Return Values

Returns a value of ESUCCESS (0) if successful. Otherwise, it returns a nonzero value.

Remarks

SetScreenAttributes sets and clears various bit flags. For example:

  SetScreenAttributes(DONT_SWITCH_SCREEN|AUTO_DESTROY_SCREEN, DONT_SWITCH_SCREEN);
  

This sets the DONT_SWITCH_SCREEN attribute and clears the AUTO_DESTROY_SCREEN attribute. Bit attributes that are not specified in mask are not affected.

Before setting the DONT_SWITCH_SCREEN bit, you need to know if the screen is a popup screen (use GetScreenInfo). If the screen is a popup screen, you need to call DropPopUpScreen one or more times. Each call to DropPopUpScreen decrements the popup screen in-use count. When the in-use count reaches 0, the function sets the DONT_SWITCH_SCREEN bit on the popup screen.

See Also

SetScreenAreaAttribute, SetScreenCharacterAttribute, SetScreenRegionAttribute