DOS function for Text Windows size

dbrunton
dbrunton used Ask the Experts™
on
I'm looking for a DOS function that I can call under text mode in DOS to tell me the text dimensions of the current window.

Normally it is 80 x 25 or 80 x 43 or 80 x 50.  In some video BIOSes you can set it up to 132 by 60.  VDOS http://sourceforge.net/projects/vdos/ also permits unusual settings and I can get Turbo Pascal to do 132 by 60 there (brief test only).

So does anyone know what I'd call in DOS to get those dimensions?  NOT how to set those dimensions.  That's a totally different game and not one I want to attempt.  I'm presuming that an offbeat text window has been set by some other application and I want to be able to read what it has been set to.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
dsackerContract ERP Admin/Consultant
Commented:
Try:  MODE CON: /STATUS

You could pipe that into the FIND command to filter on "lines" and "columns" and even set DOS variables. If you need further info on that, let me know.

Don't forget to include the CON: parameter, else it runs much slower.
dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.

Author

Commented:
Hmm.  I probably haven't explained properly.

I'm not looking for the DOS command but a DOS programming function.

Eg
int 33h and function 00h, call with ax=0000h is used to reset the mouse and get the status.
dsackerContract ERP Admin/Consultant

Commented:
Okay, that had me chuckling. Yeah, I misinterpreted. Sorry.

You may want to look at the GetConsoleDisplayMode, GetConsoleWindow, and similar Windows API functions. I think what you're looking for is in there, although it's been awhile since I have delved there.
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Fixer of Problems
Most Valuable Expert 2014
Commented:
You may be able to get the info from INT 10h, function 1Bh, but you'll have to do some arithmetic.  http://stanislavs.org/helppc/int_10.html
dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.

Author

Commented:
Probably not the Windows functions but the DOS functions that Dave Baldwin linked too.

Yeah, it's in my Ray Duncan Advanced MSDOS Programming book on page 531.  Should have looked in there first but I was lazy.

Right, so that's what I'll be doing when I get some free time.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
More info here: http://cs.lmu.edu/~ray/notes/pcvideomodes/
And this says that the video columns is listed in the BIOS data segment: http://support.microsoft.com/KB/120565  but there are problems discussed there.
dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.

Author

Commented:
No, I've actually don't have to do any fancy programming.  No need to touch INT 10h, function 1Bh or any Windows APIs.  Brain has gone into functional mode.

Turbo Pascal has a variable WindMax which has the rows and columns in it.   I've just done a quick test using WindMax and it identifies a normal 80 by 25 text screen and an extended text screen of 132 by 60.  My version of Turbo Pascal doesn't have a normal (Crt) screen unit and doesn't (default) switch into any of the standard 80 x ?? modes if it identifies a non-standard text mode.

Now I can pull the maximum values out of WindMax and use those to set the dimensions of my  text window with no problems.  So problem solved.

Merci all.
dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.

Author

Commented:
Must RTFM again and remember what is in there.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial