Solved

Printing in Turbo Pascal 1.5 for windows

Posted on 1998-12-11
6
250 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tstream to hex 1 1,670
interacting with web form 4 143
how do i remove white background in node inside virtual TVirtualStringTree? 12 92
proper way to parse url in delphi 2 164
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now