TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Etheredge
from: Peter Fitzsimmons
date: 1995-04-02 19:11:08
subject: screen color in OS/2

DE> I am writing a program designed for the OS/2 full 
 DE> screen mode and need to use 
 DE> different colored characters on the screen. In dos,there are textcolor()
 DE> and textbackground() procedures prototyped in conio.h. 
 DE> These are missing in OS/2 C-set. I know that in many 

These are,  in fact,  not "dos" functions,  but Borland
functions.  You will not find them on other [dos] compilers.

The compiler independent answer is VioWrtCharStrAtt(),  or another similar
function from the OS/2 Vio api.  For documentation on the Vio api,  see the
OS/2 1.3 toolkit on the devcon cdrom (vol 5 or 6),  or look for PRCP.ZIP on
this and many other os/2 oriented bbs's.

 DE> cases, I can use ANSI escape sequences yo acomplish 
 DE> this. Is this always acceptable in OS/2? Does OS/2 
 DE> accept ANSI escape sequences by default or do I need

Unless you have called VioSetAnsi() to turn it off,  OS/2 functions will
always support ansi codes (ansi.sys need not be loaded;  that is for dos
programs only).

 DE> calls to set color? What about direct screen writes, 
 DE> from what I understand, OS/2 does not like that at all.

You can gain access to the LVB or PVB via the Vio api;  See example code in
next message.


--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/702 3615/50 396/1 270/101 105/103 42 712/515
@PATH: 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.