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

C / C++ / MFC

 
GeneralRe: Can't find the samples :-( Pin
Zizilamoroso23-May-02 0:42
Zizilamoroso23-May-02 0:42 
GeneralStrange listbox mousewheel behaviour with XP Pin
22-May-02 12:07
suss22-May-02 12:07 
GeneralRe: Strange listbox mousewheel behaviour with XP Pin
Shog922-May-02 13:10
sitebuilderShog922-May-02 13:10 
GeneralRe: Strange listbox mousewheel behaviour with XP Pin
22-May-02 17:53
suss22-May-02 17:53 
GeneralRe: Strange listbox mousewheel behaviour with XP Pin
Shog922-May-02 18:48
sitebuilderShog922-May-02 18:48 
GeneralRe: Strange listbox mousewheel behaviour with XP Pin
23-May-02 1:53
suss23-May-02 1:53 
GeneralMultiple Print calls from CMainFrame() Pin
dazinith22-May-02 11:59
dazinith22-May-02 11:59 
GeneralRe: Multiple Print calls from CMainFrame() Pin
Roger Allen23-May-02 2:54
Roger Allen23-May-02 2:54 
This code should get you going:

void CMyView::OnBatchPrint() 
{
	DOCINFO			di ;
	CPrintInfo		printInfo ;
	CMyDoc			*pDoc = GetDocument() ;
	CString			filename ;
	CDC				dc ;
	CRect			draw_area ;

	ASSERT_VALID(pDoc) ;
	filename = pDoc->GetPathName() ;
	// make sure the compares will match
	filename.MakeLower() ;
	
	CPrintDialog	dlg(TRUE) ;
	HDC	hDC = dlg.CreatePrinterDC() ;

	if (hDC == NULL)
		return ;

	di.cbSize = sizeof(DOCINFO) ;
	di.lpszDocName = pDoc->GetPathName() ;
	di.lpszOutput = filename ;

	// prepare the print information structure
	dc.Attach(hDC) ;
	printInfo.m_bDirect = TRUE ;
	printInfo.m_rectDraw.left = 0 ;
	printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES) ;
	printInfo.m_rectDraw.top = 0 ;
	printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES) ;
	draw_area = printInfo.m_rectDraw ;

	dc.StartDoc(&di) ;
	OnPreparePrinting(&printInfo) ;

	// start printing the document
	for (printInfo.m_nCurPage = 1 ; printInfo.m_nCurPage <= printInfo.GetMaxPage() ; printInfo.m_nCurPage++)
		{
		dc.StartPage() ;
		OnPrint(&dc, &printInfo) ;
		dc.EndPage() ;
		// reset page size as OnPrint may have modified them when
		// header / footers were added to the page
		printInfo.m_rectDraw = draw_area ;
		}
	OnEndPrinting(&dc, &printInfo) ;
	dc.EndDoc() ;
	VERIFY(dc.DeleteDC()) ;
}



Roger Allen
Sonork 100.10016

If I had a quote, it would be a very good one.
GeneralRe: Multiple Print calls from CMainFrame() Pin
dazinith23-May-02 4:01
dazinith23-May-02 4:01 
GeneralRe: Multiple Print calls from CMainFrame() Pin
Roger Allen23-May-02 4:35
Roger Allen23-May-02 4:35 
GeneralRe: Multiple Print calls from CMainFrame() Pin
dazinith23-May-02 6:13
dazinith23-May-02 6:13 
QuestionHow to add a macro to active document in MFC Pin
22-May-02 11:50
suss22-May-02 11:50 
QuestionHow to add automation methods and properties in VC++7.0 Pin
Tim Ranker22-May-02 11:46
Tim Ranker22-May-02 11:46 
AnswerRe: How to add automation methods and properties in VC++7.0 Pin
Tim Ranker22-May-02 12:48
Tim Ranker22-May-02 12:48 
Generalstd::string weird behaviour??¿?¿ Pin
Carlos Sánchez García22-May-02 10:27
Carlos Sánchez García22-May-02 10:27 
GeneralRe: std::string weird behaviour??¿?¿ Pin
Joaquín M López Muñoz22-May-02 10:43
Joaquín M López Muñoz22-May-02 10:43 
GeneralRe: std::string weird behaviour??¿?¿ Pin
Dean Goodman22-May-02 10:57
Dean Goodman22-May-02 10:57 
GeneralRe: std::string weird behaviour??¿?¿ Pin
Carlos Sánchez García22-May-02 23:12
Carlos Sánchez García22-May-02 23:12 
GeneralTwo questions: CFileDialog & vector Pin
Dean Goodman22-May-02 9:59
Dean Goodman22-May-02 9:59 
GeneralRe: Two questions: CFileDialog & vector Pin
Chris Losinger22-May-02 10:01
professionalChris Losinger22-May-02 10:01 
GeneralRe: Two questions: CFileDialog & vector Pin
Dean Goodman22-May-02 10:32
Dean Goodman22-May-02 10:32 
GeneralRe: Two questions: CFileDialog & vector Pin
Joaquín M López Muñoz22-May-02 11:08
Joaquín M López Muñoz22-May-02 11:08 
GeneralExtended MAPI vs. Outlook Object Model Pin
22-May-02 9:22
suss22-May-02 9:22 
GeneralInserting strings Pin
Emearg22-May-02 8:58
Emearg22-May-02 8:58 
GeneralRe: Inserting strings Pin
Carlos Antollini22-May-02 9:25
Carlos Antollini22-May-02 9:25 

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.