| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Text colors in OS/2 |
JC> I've just started programming in Watcom 9.5 and would like to know how
JC> to change screen colors (back and forground) in an Os/2 text window.
JC> Can anyone help me?
You can use ansi codes (if you want to continue using printf() etc), or
the OS/2 text (Vio) api. For docs on the Vio api, look for PRCP.ZIP on a
fine os/2 bbs near you. Here's a small example:
#define INCL_NOPMAPI
#define INCL_VIO
#include
#include
#include
int main(void)
{
int i;
char msg[40];
BYTE attr;
VioScrollUp(0, 0, 0xffff, 0xffff, 0xffff, " \x7", 0); // cls
attr = 15; // start off with bold on black background.
for(i=0; i<22; i++){
sprintf(msg, "Line %2d: Programming is fun!", i);
VioWrtCharStrAtt(msg, strlen(msg), i, i, &attr, 0);
attr += 16; // change background colour. Note: attributes
// are just like they are under dos when poking
// into video memory.
}
VioSetCurPos(23, 0, 0); // so cursor is at bottom when program ends
return 0;
}
--- Maximus/2 2.01
* Origin: A Man's house is his hassle. (905)858-8488 (1:259/414)SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413 SEEN-BY: 711/430 807 808 809 934 942 712/353 623 713/888 800/1 @PATH: 259/414 400 99 98 3615/50 229/2 12/2442 711/409 54/54 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™.