How can i do print preview for this : ((i have a CButton OnPrint(IDC_PRINT))CDialog Base aplication) void CMyPrintDlg::OnPrint(CDC* pDC, CPrintInfo* pInfo) { CPrintDialog dlgPrint(FALSE,PD_ALLPAGES,this); if (dlgPrint.DoModal()==IDOK) { // ** Attach the printer DC from the dialog // ** to a CDC object CDC dcPrint; dcPrint.Attach(dlgPrint.GetPrinterDC()); // ** Create and fill a DOCINFO structure DOCINFO myPrintJob; myPrintJob.cbSize = sizeof(myPrintJob); myPrintJob.lpszDocName = "printing..."; myPrintJob.lpszOutput = NULL; myPrintJob.lpszDatatype = NULL; myPrintJob.fwType = NULL; // ** Start the printing document if (dcPrint.StartDoc(&myPrintJob)>=0) { // ** Start a page dcPrint.StartPage(); CString sText; sText = "this :"; CString sText1; sText1 = "How ?"; //////////////////////////////////////////////////////////////////////////////////////// dcPrint.TextOut(2000,350,sText); dcPrint.TextOut(300,500,sText1) // ** Throw the page dcPrint.EndPage(); // ** Close the document dcPrint.EndDoc(); } dcPrint.DeleteDC(); } } Please help me !
Bravoone