Incompatible with Windows

Question: A number of years ago I wrote a business application in the Microsoft BASIC Professional Development Systems that runs compiled in a DOS environment. It relies on sending control code sequences to the printer for proper page formatting. Only a handful of codes are used. The application is still in service, but now the user's computers all run Windows (probably various versions). The legacy BASIC program is run in a DOS window, but nothing comes out of the printer any more. How can this be remedied? Thank you.
Anonymous

Answer: There are three differences between DOS and Windows.

  1. DOS only runs one program at a time and allows the program to control the computer.
    Windows allows multiple programs to share the computer with Windows in control. All access to hardware therefore has to be made via Windows rather than directly.
  2. Windows provides a large library of functions to perform all of the common tasks that all programs perform called the Windows API. Using this library allows programs to pass requests to Windows to allow Windows to display on the screen (and handle all mouse functionality) as well as passing requests to Windows for access to the hardware.
  3. Windows also has a built in graphical interface (but this is trivial compared to the other two differences and doesn't affect programming).

For your program to be able to access the Printer it will need to be amended to call the Windows API to request for Windows to pass the information to the printer. Windows will then print what is requested at a time that doesn't conflict with it printing something else.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate