Solved

How to print in a dialog type application?

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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: 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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

738 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