AboutAlex Barry Expertise I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.
Experience Hobby programming since 2000
I no longer belong to any community programming groups, but do have knowledge of *basic dialects and C/C++
Question Hi Alex,I've made quite a lot of programs in QB,they still run as EXE prog.in XP & Vista but since USB printers no
longer seem to understand DOS I can't get a print-out on
paper. Do you know of any routine that would work like
"PrtScrn" that I could call from anywhere in the prog.?
Thanks and greetings from Antwerp. L.
Answer Hi, Laurent,
Yes, it is true, DOS has some trouble communicating with USB printers, but there is a handy trick you can use. First, make sure anything you print on the screen also gets printed into a file. Here is an easy way of doing that:
DECLARE SUB Print2( text AS STRING, fileHandle AS INTEGER )
DIM f AS INTEGER
f = FREEFILE
OPEN "tmp.txt" FOR RANDOM AS #f
' Instead of using: PRINT "text", now do Print2 "text", f
Print2 "This is a test", f
CLOSE #f
END
SUB Print2( text AS STRING, fileHandle AS INTEGER )
PRINT text
PRINT #fileHandle, text
END SUB
Now, after you have that, here is what I would do. Note, this ONLY works for TEXT...if you are drawing graphics
So, in the part of the code that looks like this:
CLOSE #f
END
Inbetween that, put this:
SHELL "notepad.exe /P tmp.txt"
This opens and prints it through windows' notepad program. This is a bit of a cheap hack way of doing it, but it works, and it will use Windows' printer-usb drivers, so you won't have any problems.