?
Solved

print dlg question

Posted on 1997-04-25
1
Medium Priority
?
319 Views
Last Modified: 2013-11-20
I would like to set up  a print option in my dialog box program.

I think it should go like this, am I way off base?

cprintdialog::cprintmydlg
{
        char* pBuf[100] //set up a char array of ptrs

        pBuf[0] = *m_MonPlan; //put a pointer to the member           variables
        PBuf[1] = *m_TuePlan;
        etc...

        //then print out the member variables.

        pDC->TextOut(0, pbuf); // write the string in           pbuf

        //would I use a iteration loop or will mfc print out
        //the whole string til a null char/pointer?
}

I have looked in the MS KB and got a doc, but it is still confusing to me. I understand I must get the CDC but do I need a m_startpage. any help appreciated. I have searched the msvc help, the numerous ref books, they got me this
far but when it comes to dlg boxes it isnt the most informative. Im sorry if this is obvious.
0
Comment
Question by:anglico
[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
1 Comment
 
LVL 2

Accepted Solution

by:
sapek earned 200 total points
ID: 1301196
If you are not using MFC Document/View architecture to do printing you don't need anythink like m_startpage. However you must do everything to layout the printout (just as you were printing form a none MFC app).
Generally you need thses steps:

1. Get printer DC. The easiest way to get is using windows PrintDlg (MFC's CPrintDialog class). It will display a print dialog and get you appropriate printer DC.

2. You need abort procedure and abort dialog. Read in documentation (not for MFC but for Win32, search for AbortProc) how to do this. You then use CDC::SetAbortProc to set abort proc for printing process. You can also look at some Win32 example for details how to setup and use abort proc and abort dialog

3. You must start new document (CDC::StartDoc) and new page (CDC::StartPage).

4. Use gdi functions (like TextOut) to output to the printer. You are responsible for positioning output on the paper (and things like line breaks, page breaks). You generally will want to set map mode to something other then MM_TEXT (like MM_LOENGLISH or MM_LOMETRIC), use CDC::SetMapMode for this. Note that in these map modes positive y is up.

5. call CDC::EndPage after every page

6. finish print job by CDC::EndDoc

This is general outline what you have to do print without MFC support. I sill sugest you to have a look at some Win32 example that supports printing with raw API.

Hope this helps,
Adam

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 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