Solved

How to print in a dialog type application?

Posted on 2000-03-07
5
215 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
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 50 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

832 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