ChrisDrake
asked on
How can I print color text under "cmd.exe" in windows XP
I've tried putting ansi.sys into config.nt, but later discovered that this is not relevant to "cmd.exe" (and obviously, ansi escape sequences don't just work without something to handle them).
I've tried writing a driver to call int 10h, but this blows up on the int 10h call with the following error:-
Unhandled exception ...: 0xC0000005: Access Violation.
I don't recall an INT21 interface for changing color. I can't find any hints in MSVC++ help, nor google.
I know cmd.exe can *do* color, since after dropping into NTVDM and doing color there, it returns and retains the color on the cmd.exe's screen (and the cmd.exe's output overwrites both the residual outputted text as well as the color attributes, so whatever output routine cmd.exe is using, it's programmed to *do* colour it seems; and of course you can set everything to colors other than black+white (see cmd.exe /?)... it's just not clear how to have colored output!)
I've tried writing a driver to call int 10h, but this blows up on the int 10h call with the following error:-
Unhandled exception ...: 0xC0000005: Access Violation.
I don't recall an INT21 interface for changing color. I can't find any hints in MSVC++ help, nor google.
I know cmd.exe can *do* color, since after dropping into NTVDM and doing color there, it returns and retains the color on the cmd.exe's screen (and the cmd.exe's output overwrites both the residual outputted text as well as the color attributes, so whatever output routine cmd.exe is using, it's programmed to *do* colour it seems; and of course you can set everything to colors other than black+white (see cmd.exe /?)... it's just not clear how to have colored output!)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Anyways - I wrote me my own shiny new ANSI to SetConsoleTextAttribute() converting driver, and I'm happy-as now :-)