Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printing in Turbo Pascal 1.5 for windows

Posted on 1998-12-11
6
Medium Priority
?
277 Views
Last Modified: 2008-03-06
Can anyone tell me how i can print in tubo pascal 1.5 for windows. How the print the contents of a crt window would be useful , but printing anything will do! Thanks.
0
Comment
Question by:pobwest
  • 4
  • 2
6 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 1216448
Reply to my answer on ListBoxes and I might even SEND you some code!
0
 
LVL 27

Expert Comment

by:BigRat
ID: 1216449
Thank you.
The code snippet which I have is around 150 lines long. It may be a bit too much to post here, but I can explain at bit about it.
   You need two menu entries. One to setup the printer the other to do the acutal printing. The SetupPrinter routine reads the Win.ini file via GetProfileString and extracts via a helping function StrTok the printername, driver and ouutput "port". The Driver is then loaded via LoadLibrary and one of two routines is located via GetProcAddress. The found routine is called. This displays the Setup box which is of course printer dependant.
   When you actually print you must get a device context (DC) with which you can output the text and graphics. It's almost like printing on the screen but you have to wind the pages forward. During this activity, which can take a long time, you allow the user to cancel the operation by displaying a dialog box "Printing....". This is called the Abort box and you have to have a dialog procedure for it. (Here its called PrintDlgProc). When one prints a page at a time we look to see it there are any messages for the dialog box via PeekMessage. This is done in the procedure AbortProc. We pass Windows this procedure via an Escape call. The only for loop in the code prints the pages. After each page we call Escape to do a new frame (page).
   You might find more info in Charlie Petzolds Programming Windows or a similar book by Peter Norton. These might be in your local library.
    Do you want me to post the code here, or send it via e-mail?
0
 

Author Comment

by:pobwest
ID: 1216450
yikes!, sounds complicated, I seen a previous message where:
writeln(PRN,'print this'); is used is there anyway to adapt this to TPW 1.5?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 27

Expert Comment

by:BigRat
ID: 1216451
What do you want to do? Print a file or print out from your program? If you want to print out from your program just tell me where to post the code.
   The "snippet" comes out of a program called RatHex which is a hexadecimal editor. I print the file in hex and ascii with headers and footers etc. Yes it is complicated BUT its GOOD!
(And it'll cost you only 20 cheeses!)
0
 

Author Comment

by:pobwest
ID: 1216452
go on then send the code to pobwest@yahoo.com and you can take the points.
0
 
LVL 27

Accepted Solution

by:
BigRat earned 60 total points
ID: 1216453
Code sent!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question