Full Description of File
XRAY v1.1 - Utilities which allow Windows
programs which can call a DLL (C, Visual
Basic) to access the screens of DOS
applications running in 386enh DOS Windows.
Includes examples, Libs and Include files.
Shareware by Keith P. Graham.
Contents of the XRAY.DOC file
XRAY V1.1 Copyright 1994 by Keith P. Graham.
BBS (914) 623-0039
XRAY.DLL, XRAYWIN.COM and XRAYDOS.COM are three parts of a system
which allows Windows applications to access DOS applications
running under 386 enhanced mode. There are a great many character
based programs which run very well in a DOS window yet cannot
easily communicate with Windows applications. These three
programs used in conjunction supply the solution to this problem.
I have included all that is needed to access any DOS window from
any windows program that can load and execute a simple DLL. This
includes Visual Basic and I have included a sample visual Basic
form which will capture the entire DOS screen of any application
running in a DOS 386 Enhanced windows.
Using XRAY is fairly technical. The program was designed for use
by system integrators. I wrote it in response to my own needs and
then I produced this generalized system so others will be able to
HOW TO DO IT:
1) Unzip the files in XRAY11.ZIP and place them in a directory
that is on the path. A convenient location is in the C:\WINDOWS
directory. The three files needed to make this system work are:
XRAYDOS.COM- Main screen capture program
XRAYWIN.COM - DOS communicator program
XRAY.DLL - Dynamic Link Library
Other files are:
XRAY.LIB - Used by C programmers.
XRAY.H - Also used by C. Programmers
XTEST.FRM - Sample Visual Basic 3.0 form
XTEST.MAK - Make file for VB
If you don't use C or VB you can erase any of the last 4 that you
2) Before starting windows run XRAYDOS.COM. This program requires
that it be run before windows starts so you can put it in your
autoexec.bat. XRAYDOS.COM will NOT run in a WINSTART.BAT.
(actually it sometimes works, but don't try it if you need
3) Once in Windows you can start any DOS windows that you need.
Normally you would make an ICON for a DOS application, but you
will need to run XRAYWIN.COM in each window where you want to get
screen information. The best way to do this is to create a BAT
file for each DOS application and in that BAT file start
For example if you needed to run Novell's WSLAN program in a DOS
window you could have a WSLANCAP.BAT with the lines:
When you run XRAYWIN you must give the program a number from 1 to
4 so that your windows program can tell the difference between
DOS windows. XRAY can use up to 4 windows numbered 1 to 4. They
don't have to be in any order, just so that each window that you
are capturing from has its own window number from 1 to 4.
XRAYWIN.COM will stop every second and tell XRAYDOS what it sees
on the screen. Since this only happens every second, there may be
times when an entire screen is not painted and you find part of
an old screen and part of a new screen on the DOS window.
4) Next you must add the call to the XRAY.DLL program. XRAY.DLL
talks to XRAYDOS.COM and asks it what it has stored in the
various screens. You can ask for any data on the screen. In this
version, COLOR attribute information is stripped off of the
screen and only text is returned.
To get XRAY.DLL to work with Visual Basic add the following line
to the DECLARATIONS section of a form or in a Basic module:
Declare Function XRAYfield Lib "XRAY.LIB" (byval s as string,
byval w as integer,byval y as integer,byval x as integer,
byval l as integer) as integer
(The declaration must be on one line. I made it two so its more
There are four parts to the function.
The Variable s as string is the place where you want to put
the results of your call.
Variable w as integer is the window number 1 to 4
corresponding to the window number following the XRAYWIN.COM
Variable y as integer is the row that you are trying to
access. The top row is row 0 and the bottom line is row 24.
Variable x as integer is the column of the are that you are
trying to access. The first column is 0, the last is 79.
Variable l as integer is the length of the string to pull off
of the screen.
Here is an example of getting 10 characters off of the 4th line
starting at the 32nd character from window number 2.
(notice I want the 4th line. Starting at 0 that's line 3. Column
works the same way. Column 32 is numbered from zero as column
Dim result as string,e as integer
result = String$(128,0) ' you must make a string big enough
' to fit the string from DOS
' I am safe, I make it bigger.
e = XRAYfield(result,2,3,31,10)
result = left$(result,instr(result,chr$(0))-1)
The last line is the hard one. When XRAYDOS.COM gives XRAY.DLL
the data from the screen it has a Chr$(0) at the end of the
string. This how C language ends its strings. Visual Basic has to
know the length of the string because it keeps the length of a
string separate from the string. The last line searches for the
Chr$(0) at the end of the string and then shortens the string
using Left$ to make the string end at the byte before the
Chr$(0). If you don't get this, don't worry. It works so leave it
Calling XRAY from C is much easier. Just use the H file, include
xray.lib in the make and give it a call, Making sure you pass a
long pointer to a string with enough space for XRAY.DLL to store
the results. (one byte bigger then the length of the string.)
XRAY is shareware. The program nags you when it starts up. I have
a version available for $39.95 with a printed manual and no nag
messages. The $39.95 is a site license for unlimited seats at any
ONE physical site (building). The registered version allows you
to query the cursor position in each window and in a future
version will be able to send keystrokes back to the DOS window.
If you have comments or suggestions please send them to:
Keith P. Graham
BBS (914) 623-0039
If you wish to order a registered version send $39.95 to
Erica C. Graham
238 Germonds Road
W. Nyack, NY 10994