home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / WIN_UTL2 / XRAY11.ZIP / XRAY.DOC < prev    next >
Text File  |  1994-01-04  |  6KB  |  151 lines

  1. XRAY V1.1 Copyright 1994 by Keith P. Graham.
  2.     BBS (914) 623-0039
  3.  
  4. XRAY.DLL, XRAYWIN.COM and XRAYDOS.COM are three parts of a system
  5. which allows Windows applications to access DOS applications
  6. running under 386 enhanced mode. There are a great many character
  7. based programs which run very well in a DOS window yet cannot
  8. easily communicate with Windows applications. These three
  9. programs used in conjunction supply the solution to this problem.
  10. I have included all that is needed to access any DOS window from
  11. any windows program that can load and execute a simple DLL. This
  12. includes Visual Basic and I have included a sample visual Basic
  13. form which will capture the entire DOS screen of any application
  14. running in a DOS 386 Enhanced windows.
  15.  
  16. Using XRAY is fairly technical. The program was designed for use
  17. by system integrators. I wrote it in response to my own needs and
  18. then I produced this generalized system so others will be able to
  19. use it.
  20.  
  21. HOW TO DO IT:
  22.  
  23. 1) Unzip the files in XRAY11.ZIP and place them in a directory
  24. that is on the path. A convenient location is in the C:\WINDOWS
  25. directory. The three files needed to make this system work are:
  26.  
  27.   XRAYDOS.COM- Main screen capture program
  28.   XRAYWIN.COM  - DOS communicator program
  29.   XRAY.DLL   - Dynamic Link Library
  30.  
  31. Other files are:
  32.  
  33.       XRAY.LIB    - Used by C programmers.
  34.       XRAY.H      - Also used by C. Programmers
  35.       XTEST.FRM    - Sample Visual Basic 3.0 form
  36.       XTEST.MAK    - Make file for VB
  37. If you don't use C or VB you can erase any of the last 4 that you
  38. don't need.
  39.  
  40. 2) Before starting windows run XRAYDOS.COM. This program requires
  41. that it be run before windows starts so you can put it in your
  42. autoexec.bat. XRAYDOS.COM will NOT run in a WINSTART.BAT.
  43. (actually it sometimes works, but don't try it if you need
  44. consistent results.)
  45.  
  46. 3) Once in Windows you can start any DOS windows that you need.
  47. Normally you would make an ICON for a DOS application, but you
  48. will need to run XRAYWIN.COM in each window where you want to get
  49. screen information. The best way to do this is to create a BAT
  50. file for each DOS application and in that BAT file start
  51. XRAYWIN.COM first.
  52.  
  53. For example if you needed to run Novell's WSLAN program in a DOS
  54. window you could have a WSLANCAP.BAT with the lines:
  55.  
  56.        XRAYWIN 1
  57.        WSLAN
  58.  
  59. When you run XRAYWIN you must give the program a number from 1 to
  60. 4 so that your windows program can tell the difference between
  61. DOS windows. XRAY can use up to 4 windows numbered 1 to 4. They
  62. don't have to be in any order, just so that each window that you
  63. are capturing from has its own window number from 1 to 4.
  64.  
  65. XRAYWIN.COM will stop every second and tell XRAYDOS what it sees
  66. on the screen. Since this only happens every second, there may be
  67. times when an entire screen is not painted and you find part of
  68. an old screen and part of a new screen on the DOS window.
  69.  
  70. 4) Next you must add the call to the XRAY.DLL program. XRAY.DLL
  71. talks to XRAYDOS.COM and asks it what it has stored in the
  72. various screens. You can ask for any data on the screen. In this
  73. version, COLOR attribute information is stripped off of the
  74. screen and only text is returned.
  75.  
  76. To get XRAY.DLL to work with Visual Basic add the following line
  77. to the DECLARATIONS section of a form or in a Basic module:
  78.  
  79. Declare Function XRAYfield Lib "XRAY.LIB" (byval s as string,
  80.   byval w as integer,byval y as integer,byval x as integer,
  81.   byval l as integer) as integer
  82.  
  83. (The declaration must be on one line. I made it two so its more
  84. readable). 
  85.  
  86. There are four parts to the function.
  87.  
  88.    The Variable s as string is the place where you want to put
  89. the results of your call.
  90.  
  91.    Variable w as integer is the window number 1 to 4
  92. corresponding to the window number following the XRAYWIN.COM
  93. command.
  94.  
  95.    Variable y as integer is the row that you are trying to
  96. access. The top row is row 0 and the bottom line is row 24. 
  97.    Variable x as integer is the column of the are that you are
  98. trying to access. The first column is 0, the last is 79.
  99.    Variable l as integer is the length of the string to pull off
  100. of the screen.
  101.  
  102. Here is an example of getting 10 characters off of the 4th line
  103. starting at the 32nd character from window number 2.
  104. (notice I want the 4th line. Starting at 0 that's line 3. Column
  105. works the same way. Column 32 is numbered from zero as column
  106. 31.)
  107.  
  108.    Dim result as string,e as integer
  109.    result = String$(128,0) ' you must make a string big enough
  110.                            ' to fit the string from DOS
  111.                            ' I am safe, I make it bigger.
  112.    e = XRAYfield(result,2,3,31,10)
  113.    result = left$(result,instr(result,chr$(0))-1)
  114.  
  115. The last line is the hard one. When XRAYDOS.COM gives XRAY.DLL
  116. the data from the screen it has a Chr$(0) at the end of the
  117. string. This how C language ends its strings. Visual Basic has to
  118. know the length of the string because it keeps the length of a
  119. string separate from the string. The last line searches for the
  120. Chr$(0) at the end of the string and then shortens the string
  121. using Left$ to make the string end at the byte before the
  122. Chr$(0). If you don't get this, don't worry. It works so leave it
  123. in.
  124.  
  125. Calling XRAY from C is much easier. Just use the H file, include
  126. xray.lib in the make and give it a call, Making sure you pass a
  127. long pointer to a string with enough space for XRAY.DLL to store
  128. the results. (one byte bigger then the length of the string.)
  129.  
  130. MONEY MATTERS:
  131.  
  132. XRAY is shareware. The program nags you when it starts up. I have
  133. a version available for $39.95 with a printed manual and no nag
  134. messages. The $39.95 is a site license for unlimited seats at any
  135. ONE physical site (building). The registered version allows you
  136. to query the cursor position in each window and in a future
  137. version will be able to send keystrokes back to the DOS window.
  138.  
  139. If you have comments or suggestions please send them to:
  140.  
  141.        Keith P. Graham
  142.        BBS (914) 623-0039
  143.  
  144. If you wish to order a registered version send $39.95 to
  145.  
  146.     Erica C. Graham
  147.     238 Germonds Road
  148.     W. Nyack, NY 10994
  149.  
  150.  
  151.