Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Read and write USB device Pin
Sarvan AL17-May-06 22:01
Sarvan AL17-May-06 22:01 
GeneralRe: Read and write USB device Pin
Cedric Moonen17-May-06 22:03
Cedric Moonen17-May-06 22:03 
GeneralRe: Read and write USB device Pin
Sarvan AL17-May-06 22:34
Sarvan AL17-May-06 22:34 
QuestionPrint Related issue Pin
rajeevktripathi17-May-06 20:38
rajeevktripathi17-May-06 20:38 
AnswerRe: Print Related issue Pin
Ganesh_T17-May-06 20:53
Ganesh_T17-May-06 20:53 
QuestionRe: Print Related issue Pin
rajeevktripathi17-May-06 21:28
rajeevktripathi17-May-06 21:28 
AnswerRe: Print Related issue Pin
Hamid_RT17-May-06 21:58
Hamid_RT17-May-06 21:58 
QuestionRe: Print Related issue Pin
rajeevktripathi18-May-06 2:29
rajeevktripathi18-May-06 2:29 
HI googled and studied about printing and now able to print a string buffer.

the code is as follows:

<br />
<br />
void CPrint_DialogDlg::OnPrintReport() <br />
{<br />
	 char   pbuf[100] = "Hello World.";<br />
     HDC    hdcPrn ;<br />
<br />
       // Instantiate a CPrintDialog.<br />
     CPrintDialog *printDlg =<br />
           new CPrintDialog(FALSE, PD_ALLPAGES | PD_RETURNDC, NULL);<br />
<br />
       // Initialize some of the fields in PRINTDLG structure.<br />
     printDlg->m_pd.nMinPage = printDlg->m_pd.nMaxPage = 1;<br />
     printDlg->m_pd.nFromPage = printDlg->m_pd.nToPage = 1;<br />
<br />
       // Display Windows print dialog box.<br />
     printDlg->DoModal();<br />
<br />
       // Obtain a handle to the device context.<br />
     hdcPrn = printDlg->GetPrinterDC();<br />
     if (hdcPrn != NULL)<br />
	 {<br />
         CDC *pDC = new CDC;<br />
         pDC->Attach (hdcPrn);      // attach a printer DC<br />
<br />
         pDC->StartDoc("test");  // begin a new print job<br />
                                   // for Win32 use<br />
                                   // CDC::StartDoc(LPDOCINFO) override<br />
<br />
         pDC->StartPage();          // begin a new page<br />
         SetPrintAlign(pDC, hdcPrn);// set the printing alignment<br />
         pDC->TextOut(10, 10, pbuf);// write the string in pbuf<br />
         pDC->EndPage();            // end a page<br />
<br />
         pDC->EndDoc();             // end a print job<br />
<br />
         pDC->Detach();             // detach the printer DC<br />
         delete pDC;<br />
	 }<br />
<br />
     delete printDlg;<br />
}<br />
<br />
<br />
void CPrint_DialogDlg::SetPrintAlign(CDC *pDC, HDC hdcPrn)<br />
{<br />
     short cxPage, cyPage;<br />
     <br />
	 cxPage = ::GetDeviceCaps (hdcPrn, HORZRES) ;<br />
     cyPage = ::GetDeviceCaps (hdcPrn, VERTRES) ;<br />
     pDC->SetMapMode (MM_ISOTROPIC) ;<br />
     pDC->SetWindowExt ( 1000, 1000) ;<br />
     pDC->SetViewportExt (cxPage / 2, -cyPage / 2) ;<br />
     pDC->SetViewportOrg (cxPage / 2,  cyPage / 2) ;<br />
     pDC->SetTextAlign (TA_BASELINE | TA_CENTER) ;<br />
}<br />
 <br />


Now here What I want to ask is that :
How can I handle if buffer content is of more than one page.

Better if provide some code snippet.

Thanks in advance.
AnswerRe: Print Related issue Pin
Hamid_RT18-May-06 3:38
Hamid_RT18-May-06 3:38 
QuestionRe: Print Related issue Pin
rajeevktripathi23-May-06 3:55
rajeevktripathi23-May-06 3:55 
AnswerRe: Print Related issue Pin
Hamid_RT23-May-06 4:50
Hamid_RT23-May-06 4:50 
Questionhow to view UNICODE string in VC's QuickWatch window? Pin
flyingxu17-May-06 20:35
flyingxu17-May-06 20:35 
AnswerRe: how to view UNICODE string in VC's QuickWatch window? Pin
Naveen17-May-06 20:38
Naveen17-May-06 20:38 
QuestionPoints to develope efficient and reliable Internet application Pin
zahid_ash17-May-06 20:34
zahid_ash17-May-06 20:34 
AnswerRe: Points to develope efficient and reliable Internet application Pin
Ganesh_T17-May-06 20:48
Ganesh_T17-May-06 20:48 
AnswerRe: Points to develope efficient and reliable Internet application Pin
Laxman Auti17-May-06 20:57
Laxman Auti17-May-06 20:57 
AnswerRe: Points to develope efficient and reliable Internet application Pin
ThatsAlok17-May-06 20:57
ThatsAlok17-May-06 20:57 
GeneralRe: Points to develope efficient and reliable Internet application Pin
zahid_ash17-May-06 21:10
zahid_ash17-May-06 21:10 
Questionwhich tool can create 16 and 32 bits bitmap? Pin
includeh1017-May-06 20:20
includeh1017-May-06 20:20 
AnswerRe: which tool can create 16 and 32 bits bitmap? Pin
Hamid_RT17-May-06 20:31
Hamid_RT17-May-06 20:31 
QuestionIOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
velayudhan_raj17-May-06 20:18
velayudhan_raj17-May-06 20:18 
AnswerRe: IOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
Laxman Auti17-May-06 20:36
Laxman Auti17-May-06 20:36 
AnswerRe: IOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
kakan17-May-06 20:41
professionalkakan17-May-06 20:41 
AnswerRe: IOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
Hamid_RT17-May-06 20:53
Hamid_RT17-May-06 20:53 
GeneralRe: IOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
velayudhan_raj17-May-06 21:03
velayudhan_raj17-May-06 21:03 

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.