Solved

Printing in Turbo Pascal 1.5 for windows

Posted on 1998-12-11
6
249 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 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

17 Experts available now in Live!

Get 1:1 Help Now