|
|||||||
Help: Computer Programming Question |
Share Thread
|
Subject: Computer Programming Question From: katlaughing Date: 18 Jun 00 - 12:57 AM Someone I know is writing a program in which he wants to be able to print directly to the LPT1 port without using Windows. I told him I'd bet there was a Mudcatter or two who might know how or at least be able to point us in the right direction. So....any suggestion are most welcome and appreciated. Thanks, kat |
Subject: RE: Help: Computer Programming Question From: Joe Offer Date: 18 Jun 00 - 01:23 AM Well, Kat, if it's a text file (or any ascii file), the DOS command is copy filename.xxx lpt1If it's a *.doc file or a Windows *prn file, it gets more complicated. I got it to work earlier this month, but it took me half a day to figure it out - but now I can do it with one mouse click. -Joe- |
Subject: RE: Help: Computer Programming Question From: GUEST,flattop Date: 18 Jun 00 - 01:28 AM Is he not running in windows? You could access printer ports in DOS. You can print from a web page as a page print or formatted via tools like Crystal Reports. What is he writing in? Why doesn't he want to use windows? Does he know about the Defenestration of Prague where a term was added to historical study and a word added to the english language simply because they threw one ambasador out the window? |
Subject: RE: Help: Computer Programming Question From: Escamillo Date: 18 Jun 00 - 01:33 AM From inside a program, you will surely find a command to OPEN port LPT1 as an output file of text, then WRITE(OUTFILE,...) and finally CLOSE the output file. Doing this in Delphi is pretty simple.However you will loose the great advantage of the PRINT QUEUE that Windows maintains, and then will have to wait until printing is complete before being released to continue working. If you need more details, please let me know. Un abrazo - Andrés |
Subject: RE: Help: Computer Programming Question From: katlaughing Date: 18 Jun 00 - 08:15 AM Thanks to you all, very much. I will forward this on to him and get back to you. Sorry I don't know the answers to some of your questions, but I'll bet I do after hereads this! Thank you very much, kat |
Subject: RE: Help: Computer Programming Question From: NH Dave Date: 18 Jun 00 - 10:47 AM Many programming languages allow the command: lprint "What ever line or output you wish to print"
which does a line by line printout of whatever would normally appear in the screen using the
It also may differ, depending on the language in which s/he is programming, and the platform s/he is using.
Dave |
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 18 Jun 00 - 11:04 AM As has been noted, the principle is pretty much the same in a lot of languages. Here are couple of short samples using 2 of the most popluar visual languages, that react to a button being clicked and will print "Hello Jon". DELPHI:
procedure TForm1.Button1Click(Sender: TObject); VISUAL BASIC:
Private Sub Command1_Click() I am also curious as to why he should want to bypass the Windows system. Jon
|
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 18 Jun 00 - 11:19 AM Try again: DELPHI:
procedure TForm1.Button1Click(Sender: TObject); VISUAL BASIC:
Private Sub Command1_Click() Jon |
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 18 Jun 00 - 11:24 AM Oh well, looks better but I've still got the indentation wrong. (kat, indendation makes no diference to the programs but it makes life a lot easier for us humans to read code). Jon |
Subject: RE: Help: Computer Programming Question From: katlaughing Date: 18 Jun 00 - 12:33 PM Thanks again, you guys are great! He wants to bypass Windows, as I understand it, because it is faster for the program he is writing. I've sent him your answers and invited him to check out the thread, but he is a little shy, so...for now, I'll try to answer your questions as much as possible. Believe me, this is very much appreciated. kat |
Subject: RE: Help: Computer Programming Question From: Mark Clark Date: 18 Jun 00 - 03:35 PM Kat, If printing speed is a problem from Windows, tell your friend to set the Windows printer to print directly instead of "spooling" the output to a file prior to printing. Printing directly to a low level device such as LPT1 is a generally bad idea. In the bad old days of native DOS development, all programs printed to LPT1. Since all printers work differently, when you purchased a printer, you had to have specially written print drivers (software) that understood how to interact with that printer. Each printer manufacturer was responsible for providing it's own unique drivers. There is nothing inherently associated with low level devices such as LPT1 that would allow any printing more complex then the occasional console message. With the advent of Windows, all the manufacturers' drivers were eventually included with Windows itself. That is what allows Windows to understand how to use any printer you plug in. Without Windows, your friend will need to write or buy drivers that can turn the expected output into some page description language (PDL) such as HP's Printer Control Language (PCL) or Adobe's PostScript. If your friend's printer doesn't support the use of a PDL then he may be forced to rasterize his own images and fonts. Printing output that would be considered acceptable by today's standards is not for the faint of heart. He could well spend more time writing print drivers than he will ever spend waiting for Windows to print. I'd suggest that he get into some of the development help forums such as Microsoft's MSDN and ask for some advice on speeding up his Window's printing. I promise his time will be much better spent and he'll be happier with the results. - Mark |
Subject: RE: Help: Computer Programming Question From: Escamillo Date: 18 Jun 00 - 05:51 PM Good advice, Mark.I find one possible reason for a direct printing: may be he has an old DOS-based program which has to run under Windows.It is really complicated to convert these programs to generate a text object and use the printing facilities of the object (for example a MEMO ). It is far simpler to make a couple of corrections like AssignFile instead of Assign, and then use the program as is. The text obtained will be plain, only fixed font, as in the old days, but probably useful. Un abrazo - Andrés |
Subject: RE: Help: Computer Programming Question From: Grab Date: 19 Jun 00 - 11:26 AM If he's into low-level drivers and stuff, tell him to check out the site BeyondLogic which has detailed info on all PC ports. Grab. |
Subject: RE: Help: Computer Programming Question From: katlaughing Date: 22 Jun 00 - 10:50 PM Thanks to you all, this is an update with another question. I really do appreciate it and I am sending along all of your messages. This is from my friend, who also happens to be my son-in-law and has been learning as he goes along as a programmer...he's worked up to the position and been actually programming for six months, as well as studied on his own. He and my daughter have twins to support, so it really is helpful!**BG** Here's what he has to say:
"Thank you very much, the information from Jon was what i was looking for. As to his curiosity why i would want to by pass the window system is speed. Anyway tell him I'm very grateful to him and all who sent in their answers. Hoep I got all of the line breaks and stuff right. Thanks a bunch you, guys are the best! kat
|
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 22 Jun 00 - 11:53 PM Well, I will hold my hands up and say I don't know the answer to that one. As a programmer, I am only a hobbiest but I have written programs consisting of a few thousand lines in good old Turbo Pascal. The rules seem to have changed a lot since then, and on this sort of stuff, you need to know Windows and the way the language interacts with windows - it is no longer straight coding. I can hack a little in VB but if I wan't to write something for my amusement, I use the Borland products and am more used to their ways and find their logic easier to follow. Jon |
Subject: RE: Help: Computer Programming Question From: Escamillo Date: 23 Jun 00 - 12:29 AM Sorry, neither me.. (I can´t even recognize which language he's using - seems to me a Data Base Language.) My specialty, today, is Delphi, after TPascal, various Basics, Fortran and many Assemblers, but not this one ! :) Un abrazo - Andrés |
Subject: RE: Help: Computer Programming Question From: Grab Date: 23 Jun 00 - 09:33 AM Looks unpleasantly like Visual Basic, which I've had a (very) little bit of - enough to know that it's not a nice language to work in. Grab. |
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 23 Jun 00 - 10:10 AM kat, I don't have much in the way of VB reference but I have had a play. This first part is in the MDI form and was created by VB and will open up a child form called frmDocument.
Private Sub LoadNewDoc() The MDI child form (form needs this property set) behaves correctly and closes when using the close button on the system menu. If you want a button to close the child forms, I only guess at the code below. It appears to work but I can not be sure if it frees up memory correctly.
SubPrivate Sub Command1_Click() |
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 23 Jun 00 - 10:23 AM He probably knows this but I meant to add "Me" is a pointer to the form object itself (the equivilant of self/ this in Pascal /C) Jon |
Subject: RE: Help: Computer Programming Question From: Jon Freeman Date: 23 Jun 00 - 10:33 AM Just read you comments grab, I agree that it is unpleasant to use. It is beyond me why VB seems to have so many followers when there is (IMO) the vastly superior Delphi available. Jon |
Subject: RE: Help: Computer Programming Question From: katlaughing Date: 23 Jun 00 - 10:41 AM Thanks, you guys, I will pass this on to Wayne. I have only a very rudimentary idea of anything you all are talking about, but I know enough to really appreciate your efforts and understanding! |
Share Thread: |
Subject: | Help |
From: | |
Preview Automatic Linebreaks Make a link ("blue clicky") |