Date: Mon, 11 Nov 2002 12:46:33 +0100 From: Manuel Collado Subject: Re: Trying to hide cursor on a DOS box on WinNT To: djgpp AT delorie DOT com Message-id: <3DCF9899.DF49EB58@lml.ls.fi.upm.es> MIME-version: 1.0 X-Mailer: Mozilla 4.75 [en] (WinNT; U) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en References: <3DCB85E4 DOT A96AA73B AT lml DOT ls DOT fi DOT upm DOT es> Reply-To: djgpp AT delorie DOT com Andrew Cottrell wrote: > > >I'm trying to do that with conio funtions, but fail. I've searched the > >FAQ with no luck. I'm using > > > > _setcursortype (_NOCURSOR); > > > >But it only works in fullscreen mode, not inside a DOS window. In that > >case > >the behaviour is somehow erratic, and usually the cursor shows up all > >the time. > I have used this for a long long time and it has worked for me on > everything from DOS, WIn 9x, NT 4.0 SP2 through SP6, 2K and XP. Let me explain better. The problem appears only when executing the program twice in sequence in a DOS windows (not in fullcreen mode) from the 'cmd' or 'command' prompt. When invoking 'getkey' after _setcursortype (_NOCURSOR); a spurious cursor appears at the position where the cursor was when the program was started. This spurious cursor dissapears by momentarily switching to fullscreen mode (Alt-Enter) and reappears when swtiching bat to a DOS windows mode. This behaviour can be reproduced in every machine running Windows NT or 2000 I can use (including a portable PC). > Boot up using a DOS disk and try the app. If it works then the problem > is with NT otherwise it is with the video card. > > >Is this a known issue? > Not as far as I can remember. > >Is there a workaround? > > >I'm using gcc 3.2 on WinnT 4.0 SP3. > Have you tried it on another PC running NT 4.0? A long shot could be > that it is an NT video driver or vidoe bios problem. Another thing to > try is SP6 or SP6A for NT 4.0 as SP3 is very old. I've experiment a bit, and the problem seems to be reproducible in the following circumstances: - the program is started in a DOS window. - the first 'getkey' is issued after '_setcursortype (_NOCURSOR);' - the last 'getkey' issued in the previously executed program in the same DOS window also followed a '_setcursortype (_NOCURSOR);' The following small program produces the explained effect: #include #include #include #include int main (int argc, char** argv) { int key; int turn = 2; clrscr (); cprintf ("Press any key to toggle cursor, Escape to exit\n"); gotoxy (5, 10); cputs ("Cursor here -->"); do { switch (turn++ % 3) { case 1: _setcursortype (_SOLIDCURSOR); break; case 2: _setcursortype (_NOCURSOR); break; default: _setcursortype (_NORMALCURSOR); } key = getkey (); } while (key != K_Escape); return 0; } To reproduce the bug, execute this program twice. The first time press Escape whith the cursor hidden. Perhaps this is a bug of the NTVDM emulator. Or it is a consequence of an improper way (from Microsoft's point of view) of hiding the cursor. -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado