Sets the current cursor attribute.
#include <graph.h>
short __far _settextcursor( short attr );
attr | Cursor attribute |
The _settextcursor function sets the cursor attribute (i.e., the shape) to the value specified by attr. The high-order byte of attr determines the top line of the cursor within the character cell. The low-order byte of attr determines the bottom line of the cursor.
The _settextcursor function uses the same format as the BIOS routines in setting the cursor. Typical values for the cursor attribute are listed below:
Attribute | Cursor Shape |
0x0707 | Underline |
0x0007 | Full block cursor |
0x0607 | Double underline |
0x2000 | No cursor |
Note that this function works only in text video modes.
The function returns the previous cursor attribute, or –1 if an error occurs (such as calling the function in a graphics screen mode).
Standards:None
16-Bit:DOS
32-Bit:None
_displaycursor, _gettextcursor
/* DISCURS.C: This program changes the cursor shape using _gettextcursor
* and _settextcursor, and hides the cursor using _displaycursor.
*/
#include <conio.h>
#include <graph.h>
void main( void )
{
short oldcursor;
short newcursor = 0x007; /* Full block cursor */
/* Save old cursor shape and make sure cursor is on. */
oldcursor = _gettextcursor();
_clearscreen( _GCLEARSCREEN );
_displaycursor( _GCURSORON );
_outtext( "\nOld cursor shape: " );
_getch();
/* Change cursor shape. */
_outtext( "\nNew cursor shape: " );
_settextcursor( newcursor );
_getch();
/* Restore original cursor shape. */
_outtext( "\n" );
_settextcursor( oldcursor );
}