Solved

Printing in Turbo Pascal 1.5 for windows

Posted on 1998-12-11
6
255 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

830 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