comp.lang.ada
 help / color / mirror / Atom feed
From: Al Christians <achrist@easystreet.com>
Subject: Re: more specific
Date: 2000/08/26
Date: 2000-08-26T00:00:00+00:00	[thread overview]
Message-ID: <39A839D0.6884C1E7@easystreet.com> (raw)
In-Reply-To: 39a7ed56$0$20400@echo-01.iinet.net.au

I remember doing this with the DOS version of Gnat, currently
distributed as EZ2LOAD, IIRC.  This runs under a DOS extender,
and produces executables that do the same. When you run a DOS 
program under Win95, Win98 or NT, you do get most of the features 
of DOS available for you program.  There are library functions 
that are part of the extender lib that comes with EZ2LOAD that 
you can call from the Ada program that give access to the DoS 
text video buffer.  This includes attribute bytes that control 
the color of text on the screen.  Move the right values into the 
attribute bytes, and the color of the screen will change accordingly.

Alternatively, if you can set up the target system to load Ansi.Sys
when it opens a DOS command prompt, you can set the screen colors
by printing escape sequences through the standard output from your
Ada program, and you could probably do that with programs from any 
of the Ada compilers for Windows.  Windows NT won't load Ansi.Sys, 
but I think that Windows 95 can.  Escape sequences are special output 
that are interspersed with the normal output.  Ansi.Sys watches the 
output, and when it sees an escape character (Ascii 27), it interprets 
whatever comes after it as a  control code that tells it to something 
special, like change the screen colors or move to a certain spot
on the screen.  

I'm sorry to say that it has been about five years since I did this,
so I can't recall too many details, and I haven't touched DOS in 
about 3 years, and I have pitched all my old DOS documentation.

You should be able to find documentation about Ansi.Sys somewhere 
on-line.  It is a portable way to make text-mode output a little
prettier.  It didn't catch on for DOS PC's mainly because it
slowed down the output noticeably, but with faster computers now,
I doubt anyone will notice.  It also makes a mess of your screen
if you accidentally send an escape character to the standard output
without valid control codes following.

If one set of colors is ok throughout your program, the simplest 
way to do this is to run your program from a batch file.  Compile 
and link your program as, eg, MyProg.Exe.  Then execute it with a 
batch file like:

:REM   1f is background 1=Blue, foreground F=White
Color 1F
MyProg.Exe


Al






 








Damon Carter wrote:
> 
> Im writing a program using ada95 compiler thats going to run in a dos
> window,
> and i want to change the dos window colour from black to blue.. i am
> using windows 95 and have 32bit video card.. i think
> 
> Damon, Carter




      parent reply	other threads:[~2000-08-26  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-25  0:00 change screen colour?? Damon Carter
2000-08-26  2:53 ` DuckE
2000-08-26  0:00   ` Damon Carter
2000-08-26  0:00     ` tmoran
2000-08-26  0:00       ` Marin D. Condic
2000-08-27  7:26         ` more specific Damon Carter
2000-08-26  0:00           ` more specific, was:change screen colour?? tmoran
2000-08-28  0:00             ` Jerry van Dijk
2000-08-26  0:00           ` more specific (null)
2000-08-26  0:00           ` Al Christians [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox