Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to print in a dialog type application?

Posted on 2000-03-07
5
Medium Priority
?
261 Views
Last Modified: 2013-11-20
Hi, I'm now writing a dialog type applciation using VC++6.0. I want to print some images and text but since i'm not using MDI or SDI, I don't know how to do that.. can anyone tell me how to do that?
0
Comment
Question by:rw8
[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
5 Comments
 
LVL 8

Expert Comment

by:VinExpert
ID: 2594284
Hi,

U want to display them on the dialog or U want to print to a paper using printer?

VinExpert
0
 

Author Comment

by:rw8
ID: 2594348
Sorry that I didn't make it clear. I want to printer to a paper using printer. I have no problem in drawing the objectws on the screen (dialog) using the OnPaint() function
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 200 total points
ID: 2595136
Hi rw8,

I assume it's not the dialog itself you wanna get printed ... am I right?

Then do something like this:

- use a CPrintDialog to let the user select the printer/page size ...
- use CPrintDialog::CreatePrinterDC to get a device context for the selected printer
- with this device context you can use CDC::StartDoc() and CDC::EndDoc() to start and end a printjob; within this printjob you can use CDC::StartPage() and CDC::EndPage() to control output pages. Between each StartPage() and EndPage() you can print to the printer dc using CDC functions you need. It maybe a good idea to test some capabilities of the printer using CDC::GetDeviceCaps() if you need to print i.e. bitmaps using StretchBlt().

hope that helps,

ZOPPO
0
 

Expert Comment

by:maknight
ID: 2596751
I'm not sure about printing bitmaps, but printing text can be quite an undertaking if you want to track pages and such accurately. I wrote a class and an ActiveX control to handle that for me b/c it was so "fun".
0
 

Author Comment

by:rw8
ID: 2598068
Exellent.. Thanx Zoppo.. I can print something using the printer now..
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

610 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