The information in this article applies to:
SUMMARYSometimes it is necessary to read the text from the screen of an MS-DOS session running under Windows version 3.1 in 386 Enhanced mode. Use a simple VxD to read the screen in an MS-DOS session. You don't need to access the MS-DOS session screen through the VDD or GRABBER to read it. MORE INFORMATION
In a VxD, by using VM Control Block (handle) for the virtual machine (VM)
that contains the MS-DOS session, you can obtain the base linear address of
the VM from the CB_High_Linear member of the control block. CB_High_Linear
will contain the linear address of "virtual 0000:0000" for the MS-DOS
session.
By reading at [CB_High_Linear + 449h], for example, you can determine the
screen mode active in the MS-DOS session. If it is 7, it is text
mode on an MDA adapter, and the text screen buffer is at [CB_High_Linear +
0B000h]. Otherwise, if it is a text video mode number, a color text
mode is in use in the MS-DOS session, and the text screen buffer is at
[CB_High_Linear + 0B800h].
If you determine that a color text mode is in use, the adapter could be CGA, EGA, or VGA, so the MS-DOS session could be in either 25-, 43-, or 50-line mode. The size of the screen regenerate buffer is stored at [CB_High_Linear + 044Ch]. Based on the number of bytes the screen takes and the number of screen columns, you can determine the number of screen rows. The screen regenerate buffer will typically contain one of the following values: On CGA (25 lines, 40 columns), the buffer size will be 0800h (2048d)The number of columns on the screen is stored at [CB_High_Linear + 044Ah]. By dividing the buffer size by the number of columns, then dividing by two (unless screen attributes need to be read, too), you can determine the number of rows on the screen:
NOTE: the results are not exact. Therefore, if the regenerate buffer is
greater than 4096 bytes or if the number of screen columns is not equal to
25, the result must be decremented by 1 to get the real number of screen
lines.
Once you determine the screen buffer offset, number of columns, and size of text screen, you can read the screen by dereferencing to the screen buffer and reading the characters out of the screen buffer memory. REFERENCESWindows 3.1 Device Driver Kit "Virtual Device Adaptation Guide" Microsoft Developers Network "Developers Library" CD Additional query words: 3.10 VxD VDD DISPLAY
Keywords : |
Last Reviewed: November 4, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |