[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference decwet::visual

Title:Microsoft Visual C++ bug reports and kits
Notice:Register in Topic 2. 5.Last for latest Kit
Moderator:DECWET::THOMASN
Created:Tue May 17 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:521
Total number of notes:2938

514.0. "ENABLE_PROCESSED_OUTPUT ?" by MUCTEC::BECKER (Hartmut B., VMS & Languages, Munich) Wed May 14 1997 03:22

I try to paint with some ANSI escape sequences on the NT console, but it
doesn't work as expected. ENABLE_PROCESSED_OUTPUT is the keyword that should
turn ANSI interpretation on. The doc says it should be enabled on default. I
looked into the DWORD I got from GetConsoleMode, it's value is 3: compared with
the definition it looks good.

I also tried to load ANSI.SYS in CONFIG.NT. MEM/P says its there, but it's
still not working. What am I doing wrong?

Hartmut

(NT/Alpha 4.0, VC++ 4.2b)

Example program:

// inout.cxx

#include <stdlib.h>
#include <windows.h>

int main (void) {

	HANDLE	inputHandle= GetStdHandle (STD_INPUT_HANDLE),
			outputHandle= GetStdHandle (STD_OUTPUT_HANDLE);
	char	c= 0;
	char	pos[]= "\x1b[10;20H";
	int	stop;
	DWORD	num;
	DWORD	oldInputMode, newInputMode,
			oldOutputMode, newOutputMode;

	GetConsoleMode (inputHandle, &oldInputMode);
	newInputMode= oldInputMode & ~(ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_INPUT);
	SetConsoleMode (inputHandle, newInputMode);
	
	GetConsoleMode (outputHandle, &oldOutputMode);
	newOutputMode= oldOutputMode & ~ENABLE_WRAP_AT_EOL_OUTPUT;
	SetConsoleMode (outputHandle, newOutputMode);

	WriteConsole (outputHandle, pos, sizeof pos-1, &num, NULL);
	do {
		stop= (c==3)? 1: 0;
		ReadConsole(inputHandle,&c,1,&num,NULL);
		WriteConsole (outputHandle, &c, 1, &num, NULL);
	} while ((c!=3)||!stop);

	SetConsoleMode (inputHandle, oldInputMode);
	SetConsoleMode (outputHandle, oldOutputMode);

	return EXIT_SUCCESS;
}
T.RTitleUserPersonal
Name
DateLines
514.1Oh, I forgot to mention ...MUCTEC::BECKERHartmut B., VMS &amp; Languages, MunichThu May 15 1997 02:029
Oh, I forgot to mention, it works on W95 with VC++ 4.0 and ansi.sys loaded in
config.sys. It doesn't if ansi.sys isn't loaded. Therefore I assume that
ansi.sys is also necessary on NT. Also I assume that this is documented
somewhere. From the documentation describing High-Level-Console-I/O one can
conclude it works independent of ansi.sys.

Anyway it looks like an ansi.sys hence a nt problem.
                             
Hartmut