Solved

How to print in a dialog type application?

Posted on 2000-03-07
5
194 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 30

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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