Solved

Printing in Turbo Pascal 1.5 for windows

Posted on 1998-12-11
6
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
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 20 total points
ID: 1216453
Code sent!
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Check out this step-by-step guide for asking an anonymous question on Experts Exchange.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

752 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