| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | set OS/2 FS video mode |
Hello Eddy!
Saturday September 21 1996 13:50, Eddy Thilleman wrote to All:
ET> How does one query the current video mode in a OS/2 full screen
ET> session and how does one set it at a specific video mode? I can't find
ET> information on this. I want to set the OS/2 full screen video text
ET> mode to 100 columns and 40 rows (which my ET4000 supports).
Ough! That is _TRUE_ FAQ, I guess :-)
-------------------------------8<------------------------------------
- OS2PROG (2:5020/620) ----------------------------------- OS2PROG -----
Msg : 265 of 528 From : Peter Fitzsimmons 1:259/414 Sat
15 Jul 95 20:25 To : Paul Rider Tue 18
Jul 95 02:02 Subj : Vio Screen Modes.
------------------------------------------------------------------------
PR> Is there a snippit or something with a very
PR> small example of switching screen resolutions. I need
PR> something to detect the current screen resolution,
PR> then switch to 43/50 line mode (other resolutions
PR> would also be nice, like 28, ... but *only* 80
PR> columns). If this is WAY too easy to bother with than
PR> don't. I am asking this question to save myself time.
Tip: if you are writing a text mode app, by default always be prepared to use
the video mode the user has set up. Setting the mode under os/2 can be much
more than just setting the number of rows&cols; the density of the font can
change too -- and a call to VioSetMode (even to set the same number of rows &
cols) can screw this up (especially if you are using bvhsvga.dll).
If you are using bvhsvga (look for this word in config.sys), typing "mode
80,34" (my fav mode) will pick a crappy font, whereas this little program will
select the correct font (and the one that bvhVHA uses):
// usage: "mode2 34" (or 30, others).
#define INCL_VIO
#define INCL_NOPMAPI
#include
#include
#include
#include
void main(int argc, char **argv)
{
VIOMODEINFO vi, om;
USHORT rc;
VioSetCurPos(0, 0, 0);
memset(&vi, 0, sizeof(vi));
vi.cb = 12;
vi.fbType = 1;
vi.color = 4;
vi.col = 80;
vi.row = atoi(argv[1]);
vi.hres = 720;
vi.vres = 480;
rc = VioSetMode(&vi, 0);
if(!rc)
VioScrollUp(0, 0, -1, -1, -1, " \x7", 0);
printf("mode2 rc = %d\n", rc);
}
Moral of the story: don't call VioSetMode unless you absolutely have to; call
VetGetMode() instead, and use the size it returns.
Here is a program that will write a file named "out" with the
modes that your
adapter supports:
#define INCL_VIO
#define INCL_NOPM
#include
#include
#include
#include
void main(void)
{
VIOMODEINFO vi, om;
int r, c;
USHORT rc;
FILE *of = fopen("out", "wt");
if(!of){
perror("out");
exit(3);
}
om.cb = sizeof(om);
VioGetMode(&om, 0);
VioScrollUp(0, 0, -1, -1, -1, " \x1b", 0);
VioSetCurPos(5, 0, 0);
memset(&vi, 0, sizeof(vi));
vi.cb = 8;
VioGetMode(&vi, 0);
for(c=1; c<201; c++){
for(r=1; r<66; r++){
printf("\t\t\t\t\t%3d, %3d\r", c, r);
vi.cb = 8; /*sizeof(vb);*/
/* vi.fbType = VGMT_OTHER;
vi.color = COLORS_16;*/
vi.col = c;
vi.row = r;
vi.hres = 720; // only seen if vi.cb == 12!!!
vi.vres = 480;
rc = VioSetMode(&vi, 0);
if(!rc){
vi.cb = sizeof(vi);
VioGetMode(&vi, 0);
fprintf(of, "%3d, %3d (%d x %d)\n", vi.col,
vi.row, vi.hres,
vi.vres);
}
}
}
VioSetMode(&om, 0);
printf("om.cb = %d\n", om.cb );
printf("om.fbType = %d\n", om.fbType );
printf("om.color = %d\n", om.color );
printf("om.col = %d\n", om.col );
printf("om.row = %d\n", om.row );
printf("om.hres = %d\n", om.hres );
printf("om.vres = %d\n", om.vres );
printf("om.fmt_ID = %d\n", om.fmt_ID );
printf("om.attrib = %d\n", om.attrib );
printf("om.buf_addr = %Fp\n", om.buf_addr );
printf("om.buf_length = %ld\n", om.buf_length );
printf("om.full_length = %ld\n", om.full_length );
printf("om.partial_length = %ld\n", om.partial_length );
printf("om.ext_data_addr = %Fp\n", om.ext_data_addr );
}
nb: the sample programs above were written for a 16bit compiler, but I can't
see anything that would give you a problem for Watcom or Cset++.
--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1 @PATH: 5020/620 509 443 79 5100/8 396/1 270/101 712/515 711/808 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™.