No announcement yet.

UBS port

  • Filter
  • Time
  • Show
Clear All
new posts

  • UBS port


    Recently I install a new Lexmark printer that uses a UBS port
    to communicate with the printer. I have no problem printing out
    Microsoft produced documents but when I come to print out material
    produced with PowerBASIC program it will not print. I also
    noticed that it still send the PowerBASIC document to the
    old printer, although I have indicated that it should go to the
    Lexmark printer. Do I need to change the OPEN statements in my
    PowerBASIC programs? If so to what?

    Thanks in advance.

    Fred Katzel


  • #2
    Can't get there from here. USB ports are a unique critter that
    DOS programs can't get to. Your best bet would download the eval
    copy of Lances DOSPRINT program and see if you can use that.

    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.


    • #3
      Lance's DOSPRINT will enable a DOS program to print to practically
      any Windows printer. I am a licensed user of it, myself. You can
      download the evaluation copy from:



      • #4

        I tried your suggestion only to find that DOSPRINT was already
        installed on my computer. However, I downloaded the the demo of
        DOSPRINT 2 to see if that would make a difference. It made no
        difference but now I can't print Microsoft documents!

        Any suggestions? This Lexmark printer has been a nightmare since I
        purchased it!

        Fred Katzel



        • #5
          DOSPRINT is an application that handles printing to any printer that has a Windows printer driver installed. Although DOSPRINT can make device-independent print from DOS very simple, DOSPRINT itself is not a printer driver and does not install as a resident application or anything even remotely like that. On this basis, DOSPRINT is not the cause of your latest problem(s).

          If you are unable to print "Microsoft documents" (which I take to mean you can't print from Windows applications) then something else is wrong with the PC, the driver, the printer, or even the cabling. When you try to print (from Notepad or Wordpad), do you get any error messages?

          Also, have you experienced any GPF's at all since your last reboot, even from completely unrelated applications?

          If so, you should reboot the PC again now to make sure the OS and the actual Lexmark driver are running in a "stable" environment, then confirm that you can print from Notepad or Wordpad, and then test DOSPRINT again.


          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          mailto:[email protected]


          • #6

            I am now able to print from a Microsoft document but still no
            response to printing from a non-Microsoft document. Do I need to
            put something in my PowerBASIC document to have it print to




            • #7
              From what you describe:
              (1)You had an old printer that presumably printed from both
              PB/DOS programs and Windows applications.
              (2)Your new Lexmark uses USB interface, is understandably
              invisible to your PB/DOS programs, has worked with your Windows
              applications, won't work with Lance's DOSPRINT, but as you
              you say, "has been a nightmare since I purchased it!"

              All of this suggests that your system has some miles on it.
              If you happen to be running Win95 OSR-2 (or as some claim, any
              Windows version prior to WIN98 SE), you probably have a USB
              software bug in Windows. MS has acknowledged this problem to
              AutoDesk and several other software vendors. The only sure
              fix is to upgrade to Win98 SE or newer.

              In any case, the problem is unlikely to have anything to do with

              Jim Cody

              Jim C.


              • #8

                When I first purchased the new Lexmark I tried everything to get it
                to work. I had a long dialog with IBM my computer supplier. At
                that time my system was working under WINDOWS 98 version 2.0.
                After consideable lost time I was recommended to upgrade to
                Windows XP which I did. I been using Windows since November 2002.
                Still no results to print out PowerBASIC documents. The upgrade to
                Windows XP has produced other problems with some of my other pro-
                grams (not PowerBASIC how ever). I don't know what to do. I have
                been thinking to reload Windows 98 and taking the Lexmark back. If
                they will take it back.

                Fred Katzel



                • #9
                  Originally posted by Fred Katzel:
                  Still no results to print out PowerBASIC documents.
                  Fred, if you want to print out PB/DOS source code, you will have
                  to bring it up in a windows word processor and print it out to
                  the USB printer from there.

                  Without DOSPRINT or something similar, your only other option
                  of printing generated data is to write the data to disk, bring
                  it up in a windows word processor and print it out from there.

                  The problem is not with your operating system, printer or PB/DOS.
                  DOS programs cannot access USB devices directly.


                  [This message has been edited by Mel Bishop (edited April 15, 2003).]
                  There are no atheists in a fox hole or the morning of a math test.
                  If my flag offends you, I'll help you pack.


                  • #10
                    Hi Mel

                    It would appear that I should upgrade to PowerBASIC Console 3.
                    Since I have tried in the past to bring other (not Powerbasic)
                    material to be using in a Window program without success. But
                    before I do that I have a few questions. I have DOSPRINT in my
                    computer do I need to do anything to insure the my PowerBASIC
                    printout is recognized? Will PC/CC be able to communicate via the
                    USB port material produced by the PB/CC program? Is there an up-
                    grade from PB/DOS to PB/CC?

                    Fred Katzel



                    • #11
                      pb/cc might be a good way forward for you, but lets get a few fact together to make sure the situation with windows printers is clear.

                      first, pb/cc and pb/dos are separate and supported product lines, so there is no specific upgrade path as such. what pb/cc offers is a programming environment that is much closer to that of dos than of windows, but with all the advantages that windows offers (such as 2gb of memory for arrays, strings, etc).

                      while pb/cc also supports lprint (with extensions over and above the ability of the pb/dos lprint statement), the lprint statement in pb/cc does not support windows-only printers.

                      the reason is much the same as with dos -- windows-only printers do not have built-in fonts or firmware to decode print data. instead, they rely on their own driver to produce a proprietary data stream (similar to a bitmap file).

                      what this means is that in order to print to a windows-only printer, you must resort to api-based printing. this involves a reasonably complex set of graphic and printer management function calls (api calls) that are required to set up and manage even a basic print operation.

                      these apis work [transparently] through the printer's own driver, and therefore satisfy the windows-only "requirement" that these printer insist upon. complex, yes. powerful? you bet. device independent printing? pretty much.

                      to get some idea of what you'll be facing when writing api-based printing code, take a look at a "basic" example of printing code at

                      now there are easer ways to achieve api-based printing from a pb/cc (or pb/win) application... use a 3rd-party library. for example, dllprint (the brother of dosprint) from and ddoc from

                      both of these libraries are commercial products and work quite differently too. for example, dllprint uses the exact same print job data formats and codes as dosprint, you if you change your existing dos code to use dosprint, you'll find moving to pb/cc with dllprint to be dead easy (or you could continue to use dosprint and shell to it from your pb/cc application!). conversely, ddoc offers a comprehensive set of functions that are reminiscent of using api-based printing, but with a substantially reduced amount of code.

                      i hope this helps!

                      powerbasic support
                      mailto:[email protected][email protected]</a>
                      mailto:[email protected]


                      • #12
                        Hi Lance

                        Thanks for the information on PB/CC and that it might not solve
                        my problem. However, you didn't answer one question that I raised
                        in my previous message, " I need to do anything (to my PB
                        programs) to insure the PowerBASIC printout is recognized? (by my
                        Lexmark printer)" In your latest message, in your last paragraph
                        you alluded that, "if you change your existing DOS code to use
                        DOSPRINT." What did you mean by that? It might answer my question.

                        Fred Katzel



                        • #13
                          DOSPRINT simply requires your app to place it's print data in a disk file. You then pass the name of the disk file to DOSPRINT as a command-line parameter, and it takes over from there, handling printing to any installed printer, be it USB, LPT, serial, network, windows-only, etc. To do this, your print data should either use ESC/P (Epson) printer codes or plain text, and you must have an appropriate printer installed.

                          Therefore, if your code uses LPRINT statements, you'll have to add in a line to open a disk file, and change the LPRINT statements to PRINT# statements instead. If your code uses PRINT# to write to a LPT port, then you'll only need to change the OPEN statement and add a line of code to SHELL to DOSPRINT.EXE. What could be easier? For more information, download the fully functional evaluatation version of DOSPRINT from and read through the DOSPRINT.HLP file - it gives a complete list of command-line switches and supported escape code, etc.

                          Since PB/CC and PB/Win support the same file I/O statements, moving those portions of DOS code to PB/CC or PB/Win to continue using DOSPRINT or even DLLPRINT is generally quite effortless. Converesly, using API based printing or DDOC (sorry Don!) would require you to rewrite the printing code completely if you move to Windows.

                          PS: if you really want to spruce up your print jobs, did you know that DOSPRINT also allows you to include graphics in your print jobs too? It supports six different image formats too (BMP, JPG, PNG, TIF, PCX, and TGA). Using a simple escape string, you simply specify how wide/high you want the image, and you can control the aspect ratio and even include two different borders around each image too. DOSPRINT imposes no limit to the number of images per page either (the limit is usually governed by the driver and/or the printer itself). Naturally DLLPRINT supports the same functionality too.

                          PowerBASIC Support
                          mailto:[email protected][email protected]</A>
                          mailto:[email protected]


                          • #14
                            I have an HP 970 inkjet printer that uses the USB port along with Power Basic for DOS. I use "Enable printer pooling" to get the printer to work with lprint functions.



                            • #15
                              Hi Mel

                              I read through the DOSPRINT.HLP file and included the following
                              statements to a program as test. At the beginning of the program
                              right after the ERROR statement I added $INCLUDE "C:\DOSPRINT.INC"
                              statement as DOSPRINT indicated to be added to PowerBASIC programs
                              I recieved the following ERROR 493: COMPILER FILE NOT FOUND. A
                              search of my computer files indicate that it was present as I used
                              it in the $INCLUDE statement. Then later in the program when I
                              wanted to print out something I added: SHELL "DOSPRINT.EXE PRNTFILE>TXT"
                              and on the next line OPEN "PRNTFILE.TXT" FOR OUTPUT AS #2. Do you
                              see any mistakes?




                              • #16

                                You are a lucky guy because these nice fellas have been extra kind to you! If you were posting to a typical Windows Newsgroup, the pompous MVPs and MSFTs would have had you for lunch by now!

                                However, since I'm a semi-retired old fart with mostly time on my hands, I'll take another wack at this forum thread.

                                (1) You bought a new USB-interface Lexmark printer.
                                (2) You installed it on your PC sometime after you upgraded your O/S from Win 98SE to Win XP (in 2002).
                                (3) You want to print reports from your PB/DOS programs to the Lexmark printer.
                                (4) You can print what you call Microsoft documents (presumably from Notepad, Wordpad, Word, Excel, etc.).
                                (5) You have been frustrated by both Win XP and the new Lexmark printer:
                                --- (a) "Windows XP has produced other problems with some of my other programs (not PowerBASIC however)."
                                --- (b) "This Lexmark printer has been a nightmare since I purchased it!"

                                It seems to me that we have a pile of issues and a lot of unknown variables to resolve before you are relatively happy with the performance of your PC, Win XP, Lexmark printer, and your PB/DOS programs!

                                Basic Unknowns:
                                (1) What PC? Brand/model/cpu/memory? Spanning Win98SE to installation of Win XP in 2002, your PC could date back to hardware shipped in 1999 (but probably integrated in 1998).
                                (2) What USB port? USB 1.0 or USB 2.0? (usually USB 1.0 if not explicitly specified on your original hardware summary).
                                (3) What XP? Home or Pro? What version (from <My computer>/<Properties> and more explicitly from <VER> at NT Command Prompt)?
                                (4) What Lexmark? You have given us no clue. What technology: laser, inkjet, impact, LCD (Kodak acquisition)? Given dozens of possibilites, what is your exact Lexmark model number? BTW, if your printer turns out to be one of the several models that support both USB and Parallel ports, a PowerBASIC forum administrator should lock this thread, and we should all go directly to the nearest pub!

                                About General Win XP Issues & Annoyances:
                                (1) When you upgraded to XP, did you choose Quick Upgrade or New Installation (i.e., clean install)? This matters, and will be asked, when you seek help for many specific problems encountered after XP was installed.
                                (2) You should consistently use <Windows Update> and <Office Update> to update your Microsoft software. When you seek help, the first level of response will usually be conditioned by this issue. As the Bush Administration warned France, you run the risk of becoming irrelevent if you don't join the update coalition.
                                (3) Whatever annoys, impedes, or confounds you after installing XP has been, and is being, experienced by a multitude of other XP users.
                                (4) Microsoft offers unprecedented self-help resources for XP. From the XP Home Page <>, you can navigate and search your way to help and guidance for literally thousands of issues and features.
                                (5) Virtually every conceivable user question or problem gets posted to the Windows XP newsgroups served by MSNEWS.MICROSOFT.COM. You can ask for help or search these XP newsgroups for guidance on any issue.
                                (6) <> recognizes expert newsgroup contributers like Doug Knox, who routinely responds to over 2,000 questions per month. More significantly, this page links you to XP support sites where these experts have compiled answers to frequently asked newsgroup questions.

                                Depending on your enthusiasm, you can devote a little or a lot of time to researching and resolving general Windows XP issues and annoyances. Highly motivated enthusiasts have been known to shed their jobs and families in order to pursue recognition as expert users and earn coveted honorary credentials.

                                About Your USB History:
                                From 1996 through 1999, many PC OEMs integrated USB hardware but shipped few (if any) USB devices because Windows did not support USB ports until the now infamous USB Supplement was added to the OSR-2 release of Win 95. Because some of the early USB hardware was suspect and the OSR-2 Supplement was bug-ridden, many OEMs (e.g., Gateway and others) elected not to install the USB Supplement in OSR-2 (and sometimes OSR-2.5) systems. Until Win 98SE, PC usage of USB devices lagged far behind Apple usage of USB devices. Even with Win 98SE, some carryover hardware/software compatibility issues impeded the acceptance of USB as a recommended interface for critical devices. Furthermore, when USB devices did become popular in the replacement and add-on markets for mice, keyboards, floppies, printers, scanners, and ZIP drives, a flurry of USB hubbing, cabling, software, and hardware issues arose when users asked long-dormant USB ports to actually perform. Because we have very little precise information about your PC, it seems prudent to ask:
                                (1) When was your PC manufactured or shipped?
                                (2) What USB devices preceded your Lexmark printer and how do/did they perform? As usual, precise device information is desirable.
                                (3) What USB devices succeeded your Lexmark printer and how do/did they perform?

                                About You Lexmark Printer:
                                Have you checked <> to obtain official Lexmark information about your printer?
                                (1) For some business models, Lexmark recommends a driver that is included on the Win XP CD. For other business models and ALL home models, Lexmark recommends drivers that must be downloaded from Lexmark. Therefore, even if Win XP automatically installed an XP print driver for your printer, there is a good chance that Lexmark recommends replacing it with the latest Lexmark driver. I found it curious that a downloaded driver is recommended for ALL home models.
                                (2) Some USB printer specifications explicitly state USB 2.0. Usually, when printer manufacturers say this, they offer a new driver with enhanced XP support for USB 1.0, or they actually mean USB 2.0 is required.

                                While your printer has nominally worked (with some degree of frustration), you would be wise to follow Lexmark recommendations. When you are synchronized with Lexmark support recommendations, you should suspect XP issues, USB cable/hub issues, or printer hardware malfunctions if you experience problems printing from Windows-XP-certified applications.

                                Printing From PB/DOS Applications To USB Printers:
                                Some form of redirection is mandatory in order to send a report stream created in a PB/DOS program to a USB printer. In addition, when the report stream actually reaches the printer it must conform to the manufacturer's printer control specifications, which may offer one or more industry standards as acceptable control languages for instructing the printer how to interpret report data and execute printer functions.

                                To illustrate how this might work, let us assume that:
                                (1) Your PB/DOS programs will initiate redirection by writing report streams to sequential disk files.
                                (2) You will invoke Windows software to read your report files and send appropriate report streams to the USB printer.
                                (3) You want to produce typical business application reports using:
                                --- (a) 8.5x11 inch paper stock.
                                --- (b) Portrait orientation.
                                --- (c) Fixed-length horizontal character spacing options.
                                --- (d) Fixed-length vertical line spacing options.

                                Your PB/DOS programs (like all other programs) must format raw text streams to conform with a report layout specification that includes considerations such as:
                                (1) Maximum text characters per line including spaces characters (usually 80 at 10CPI, or 132 at 16.66CPI).
                                (2) Horizontal position of each text character within each line.
                                (3) Maximum lines per page including blank lines (usually 60 at 6LPI, or 80 at 8LPI).
                                (4) Line delimiters (CR/LF behind last text character or CR/LF by itself).
                                (5) End-of-page delimiters (excluding final report page, implemented by one of two methods):
                                --- (a) Reduce maximum lines per page by one and append FF behind CR/LF in last line on page, or
                                --- (b) Use CR/FF instead of CR/LF as line delimiter in last line on page.
                                (6) Optional top margin (often represented by blank lines at the top of each page).
                                (7) Optional bottom margin (usually achieved by reducing maximum lines per page).
                                (8) Optional left margin (often represented by a fixed number of leading spaces).
                                (9) Optional right margin (usually achieved by reducing maximum text characters per line).
                                (10) Optional pages headings (one or more text lines at the top of each page).
                                (11) Optional page numbers (in a page heading line or in a footer line at the bottom of each page).
                                (12) Optional pagination enhancements for keeping blocks of lines together (e.g., subheader blocks, data table blocks, double-spaced line pairs, etc.).

                                In addition, some form of Printer Control Language (PCL) must be superimposed on your report layout specifications. You will need to implement PCL expressions within your PB/DOS programs.
                                (1) PCL expressions are special character sequences that will not print.
                                (2) PCL expressions are inserted in formatted report streams as commands that instruct printers how to interpret report data and execute printer functions.
                                (3) For business application reports, typical requirements for inserting PCL expressions are:
                                --- (a) Immediately prior to first line of each page.
                                --- (b) Immediately prior to CR in any line which precedes a change in vertical/horizontal spacing.

                                While much more complicated PCL insertion requirements may be devised (and would be necessary for applications such as word processing), these simple guidelines suffice for typical business application reports.

                                There are three ways you could implement a Printer Control Language in your PB/DOS programs:
                                (1) Invent your own language and then build a printer to obey your control language. Of course, you would need to build a printer for every PC that uses your PB/DOS programs. With this method, you need Windows software to send the unaltered contents of your report files to your printer.
                                (2) Choose a printer model and then use PCL expressions specified by the printer manufacturer. All users of your PB/DOS programs would need to buy the same printer model, or you could offer alternatives by adding more Printer Control Languages to your PB/DOS programs so that they would be multilingual and support more than one printer model, but user intervention would be required to identify a target printer model. With this method, you need Windows software to send the unaltered contents of your report files to the target printer.
                                (3) Adopt a Printer Control Language that has already been specified and always use it when you create report files. This method requires the least amount of work by you. However, with this method, you need Windows software that will read your report files, recognize your adopted PCL, identify installed printer model(s), select a target printer, create a tranlated report stream that is compatible with the target printer model, and send the translated report stream to the target printer.

                                I have never tried method number one (1), so I hope you keep us posted about your progress if you choose this approach.

                                I have used the latter two methods, but I would recommend number three (3) for your purposes. Furthermore, Windows utility DOSPRINT provides all of the Windows software functions needed to implement method number three (3).

                                With reference to your last posting where you are trying to implement DOSPRINT:
                                (1) I doubt that DOSPRINT.INC was actually installed in the root directory of your system drive. A more likely location might be "C:\DOSPRINT\DOSPRINT.INC".
                                (2) It appears that you need to make a subtle but important change in tactics. You should always open/write/close report files BEFORE you invoke DOSPRINT to print them.
                                (3) I presume that "PRINTFILE>TXT" was merely a typographical error.
                                (4) Unless you omitted paths for the sake of brevity, you should consider the benefits of using fully qualified filespecs.

                                Hope this helps. Good luck!

                                Jim C.

                                [This message has been edited by Jim Cody (edited April 25, 2003).]
                                Jim C.


                                • #17

                                  To answer some of your questions, but before I do I must say
                                  that just before I downloaded your message I did some experiment-
                                  ing and was able for the first time to print something from a
                                  PowerBASIC program, although it contained SAMPLE down the page, as
                                  I just have the DEMO version of DOSPRINT. I plan to purchase the
                                  full version shortly.

                                  Now to answer your questions:
                                  1. I have a IBM Model 1492 that I bought in 2000. I bought it from a
                                  software developer who I understood bought it the year before. It
                                  came with Windows 98SE loaded.
                                  2. I upgraded to Window XP only after I purchased my Lexmark X73
                                  (my first encounter with the UBS port) and several months of corres-
                                  pondance with Microsoft and other computer experts that maintained that
                                  Windows 98SE would recognize the UBS port. But even the computer
                                  experts could get Windows 98SE to recognize the UBS port.
                                  3. I have been having a running dialog with Lexmark at the same
                                  time as I have been having correspondence with PowerBasic on this
                                  4. PRINTFILE.TXT was taken from an example in DOSPRINT.HLP file.

                                  Fred K



                                  • #18
                                    although it contained SAMPLE down the page, as I just have the DEMO version of DOSPRINT.
                                    I have been trying to think of a good way to send out demos.. just overrinting "SAMPLE" or FACSIMILE" would work great for me! Thanks for the idea! (whatever DOSPRINT is, sounds like it came from there).

                                    Michael Mattias
                                    Tal Systems (retired)
                                    Port Washington WI USA
                                    [email protected]


                                    • #19
                                      Michael, you can always try it for yourself by downloading the fully functional demo version from

                                      PowerBASIC Support
                                      mailto:[email protected][email protected]</A>
                                      mailto:[email protected]


                                      • #20
                                        Good seizure of a marketing opportunity, Lance, but "doing" it is not a problem... "thinking of what to do" was my barrier...

                                        (DOS? what's DOS?)

                                        Michael Mattias
                                        Tal Systems (retired)
                                        Port Washington WI USA
                                        [email protected]