Click here to Skip to main content
16,016,345 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralOutlook (Express) Automation Pin
peterchen23-May-02 6:54
peterchen23-May-02 6:54 
GeneralRe: Outlook (Express) Automation Pin
Shog923-May-02 7:36
sitebuilderShog923-May-02 7:36 
General.lib to pack a folder/multiple files Pin
peterchen23-May-02 6:47
peterchen23-May-02 6:47 
GeneralRe: .lib to pack a folder/multiple files Pin
Roger Stewart23-May-02 7:24
professionalRoger Stewart23-May-02 7:24 
GeneralRe: .lib to pack a folder/multiple files Pin
Mike Nordell23-May-02 7:35
Mike Nordell23-May-02 7:35 
GeneralRe: .lib to pack a folder/multiple files Pin
Neville Franks23-May-02 12:45
Neville Franks23-May-02 12:45 
GeneralPrinting with displaying CPrintDialog() Pin
dazinith23-May-02 6:33
dazinith23-May-02 6:33 
GeneralRe: Printing with displaying CPrintDialog() Pin
Roger Allen23-May-02 7:26
Roger Allen23-May-02 7:26 
Further to my reply in your other thread.

Looking at the code, if your getting a valid DC then I would expect this to work. The first things to check are that you are setting the number of pages you want to print in the views OnPreparePrinting function. For testing I would by default set this to 1.

pInfo->SetMaxPage(1) ;


You will then know exactly how many times the loop will run for. The next thing is to check for the document corruption that is happening. Put a breakpoint at the start of the for loop, and try stepping over the function in it while viewing the pDoc object in the variables/watch window. If you see any of them change (turn red), then you will see in what procedure the corruption of your doc object is happening. I would most probably think that its the CView::OnPrint() or CView::OnDraw() procedures at fault. As this code you are using is a derivative of code I used for printing documents to a PDF file (where I get a DC for a PDF printer driver), I would expect all that to work without problems.

I just noticed that there is a call to CView::OnBeginPrinting() missing just before the for loop, this is probably what will set the m_bPrinting falg for OnDraw to work correctly. It may also do some other miscellaneous stuff to avoid the corruption that is happening.

If you have further problems, post some updated code and we can go from there. It may also help to post the OnDraw() code of your view.



Roger Allen
Sonork 100.10016

If I had a quote, it would be a very good one.
GeneralRe: Printing with displaying CPrintDialog() Pin
dazinith23-May-02 8:45
dazinith23-May-02 8:45 
GeneralRe: Printing with displaying CPrintDialog() Pin
Jonathan Craig23-May-02 10:59
Jonathan Craig23-May-02 10:59 
GeneralSorting a vector Pin
DrZOO23-May-02 5:41
DrZOO23-May-02 5:41 
GeneralRe: Sorting a vector Pin
Chris Losinger23-May-02 5:41
professionalChris Losinger23-May-02 5:41 
GeneralRe: Sorting a vector Pin
DrZOO23-May-02 6:12
DrZOO23-May-02 6:12 
GeneralRe: Sorting a vector Pin
Chris Losinger23-May-02 6:18
professionalChris Losinger23-May-02 6:18 
GeneralRe: Sorting a vector Pin
DrZOO23-May-02 6:36
DrZOO23-May-02 6:36 
GeneralRe: Sorting a vector Pin
Chris Losinger23-May-02 7:04
professionalChris Losinger23-May-02 7:04 
GeneralRe: Sorting a vector Pin
peterchen23-May-02 7:05
peterchen23-May-02 7:05 
GeneralShow desktop Pin
obr23-May-02 5:22
obr23-May-02 5:22 
GeneralRe: Show desktop Pin
Joaquín M López Muñoz23-May-02 8:53
Joaquín M López Muñoz23-May-02 8:53 
GeneralRe: Show desktop Pin
obr23-May-02 19:26
obr23-May-02 19:26 
GeneralOpening urls in new browser window Pin
Chris Hambleton23-May-02 5:07
Chris Hambleton23-May-02 5:07 
GeneralRe: Opening urls in new browser window Pin
RobJones23-May-02 7:33
RobJones23-May-02 7:33 
GeneralRe: Opening urls in new browser window Pin
Chris Hambleton23-May-02 7:50
Chris Hambleton23-May-02 7:50 
GeneralATL/WTL message routing Pin
_Magnus_23-May-02 4:53
_Magnus_23-May-02 4:53 
GeneralRe: ATL/WTL message routing Pin
Tim Smith23-May-02 4:55
Tim Smith23-May-02 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.