[comp.os.msdos.programmer] How to turn the cursor off

dank@calvin.usc.edu (Dan King) (02/03/91)

Here's one that I'm sure is in every compendium of Frequently Asked
Questions that has ever existed:

Using Turbo C (v2.0->I know it's outdated, but it's what I've been
using for years), how do I turn off the infernal cursor?  I'm using
lots-o-console IO routines and the blinking cursor is really annoying.
Any help would be appreciated.

dank

jdb@reef.cis.ufl.edu (Brian K. W. Hook) (02/03/91)

In article <29796@usc> dank@calvin.usc.edu (Dan King) writes:
>
>Here's one that I'm sure is in every compendium of Frequently Asked
>Questions that has ever existed:
>
>Using Turbo C (v2.0->I know it's outdated, but it's what I've been
>using for years), how do I turn off the infernal cursor?  I'm using
>lots-o-console IO routines and the blinking cursor is really annoying.
>Any help would be appreciated.
>
>dank

Well, I guess that there are two common methods of turning off the cursor
in text mode on a PC.  The first is via moving the cursor off the screen
to a NULL location, or just setting its size to zero.  I set the size
to zero....

void cursorOff ( void )
{
union REGS regs;

	regs.h.ah=0x01;	/* Subfunction 0x01 is set cursor size */
	regs.x.cx=0x00; /* CH and CL are both set to zero for start and */
			/* and ending scan lines */
	int86(0x10,&regs,&regs); /* Generate an interrupt to 0x10, the */
				 /* video interrupt */
}

Note that usually you will also want to save the cursor size.  For more
information, refer to "The New Peter Norton Programmer's Guide to The IBM
PC and PS/2".

Another method is via using inline asm...I use TC++, so I don't know if
the syntax is the same as TC 2.0....

asm {
	xor cx,cx
	mov ah,1H
	int 10
}

Using Turbo C++ there is something like a _settextcurosr(CURSOR_OFF) or
something like that.  GHope this helps.

Brian

weiss@theory.lcs.mit.edu (Paul G. Weiss) (02/04/91)

According to Microsoft's on-line help, setting the start and end
scan lines of the cursor to 32 (20h) is more device independent
way to hide the cursor.