From fc473e0f6387fffac400cd69f6dca1356bcb84d3 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Wed, 27 Jan 2010 02:25:10 -0500 Subject: [PATCH] wordpad: Reset rc.bottom between calls to EM_FORMATRANGE. EM_FORMATRANGE will set rc.bottom within the FORMATRANGE struct to be the bottom of the area actually printed to, so this must be reset between calls to make sure that the page boundaries are consistent between the pages. --- programs/wordpad/print.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/programs/wordpad/print.c b/programs/wordpad/print.c index dc18966504f..b920a4f3a69 100644 --- a/programs/wordpad/print.c +++ b/programs/wordpad/print.c @@ -243,9 +243,11 @@ static int get_num_pages(HWND hEditorWnd, FORMATRANGE fr) do { + int bottom = fr.rc.bottom; page++; fr.chrg.cpMin = SendMessageW(hEditorWnd, EM_FORMATRANGE, TRUE, (LPARAM)&fr); + fr.rc.bottom = bottom; } while(fr.chrg.cpMin && fr.chrg.cpMin < fr.chrg.cpMax); @@ -260,7 +262,9 @@ static void char_from_pagenum(HWND hEditorWnd, FORMATRANGE *fr, int page) for(i = 1; i < page; i++) { + int bottom = fr->rc.bottom; fr->chrg.cpMin = SendMessageW(hEditorWnd, EM_FORMATRANGE, TRUE, (LPARAM)fr); + fr->rc.bottom = bottom; } } @@ -328,6 +332,7 @@ static void print(LPPRINTDLGW pd, LPWSTR wszFileName) StartDocW(fr.hdc, &di); do { + int bottom = fr.rc.bottom; if(StartPage(fr.hdc) <= 0) break; @@ -335,6 +340,7 @@ static void print(LPPRINTDLGW pd, LPWSTR wszFileName) if(EndPage(fr.hdc) <= 0) break; + bottom = fr.rc.bottom; printedPages++; if((pd->Flags & PD_PAGENUMS) && (printedPages > (pd->nToPage - pd->nFromPage)))