Click here to Skip to main content
14,879,631 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Read and write USB device Pin
Sarvan AL17-May-06 22:01
MemberSarvan AL17-May-06 22:01 
GeneralRe: Read and write USB device Pin
Cedric Moonen17-May-06 22:03
MemberCedric Moonen17-May-06 22:03 
GeneralRe: Read and write USB device Pin
Sarvan AL17-May-06 22:34
MemberSarvan AL17-May-06 22:34 
QuestionPrint Related issue Pin
rajeevktripathi17-May-06 20:38
Memberrajeevktripathi17-May-06 20:38 
AnswerRe: Print Related issue Pin
Ganesh_T17-May-06 20:53
MemberGanesh_T17-May-06 20:53 
QuestionRe: Print Related issue Pin
rajeevktripathi17-May-06 21:28
Memberrajeevktripathi17-May-06 21:28 
AnswerRe: Print Related issue Pin
Hamid_RT17-May-06 21:58
MemberHamid_RT17-May-06 21:58 
QuestionRe: Print Related issue Pin
rajeevktripathi18-May-06 2:29
Memberrajeevktripathi18-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
MemberHamid_RT18-May-06 3:38 
QuestionRe: Print Related issue Pin
rajeevktripathi23-May-06 3:55
Memberrajeevktripathi23-May-06 3:55 
AnswerRe: Print Related issue Pin
Hamid_RT23-May-06 4:50
MemberHamid_RT23-May-06 4:50 
Questionhow to view UNICODE string in VC's QuickWatch window? Pin
flyingxu17-May-06 20:35
Memberflyingxu17-May-06 20:35 
AnswerRe: how to view UNICODE string in VC's QuickWatch window? Pin
Naveen17-May-06 20:38
MemberNaveen17-May-06 20:38 
QuestionPoints to develope efficient and reliable Internet application Pin
zahid_ash17-May-06 20:34
Memberzahid_ash17-May-06 20:34 
AnswerRe: Points to develope efficient and reliable Internet application Pin
Ganesh_T17-May-06 20:48
MemberGanesh_T17-May-06 20:48 
AnswerRe: Points to develope efficient and reliable Internet application Pin
Laxman Auti17-May-06 20:57
MemberLaxman Auti17-May-06 20:57 
AnswerRe: Points to develope efficient and reliable Internet application Pin
ThatsAlok17-May-06 20:57
MemberThatsAlok17-May-06 20:57 
GeneralRe: Points to develope efficient and reliable Internet application Pin
zahid_ash17-May-06 21:10
Memberzahid_ash17-May-06 21:10 
Questionwhich tool can create 16 and 32 bits bitmap? Pin
includeh1017-May-06 20:20
Memberincludeh1017-May-06 20:20 
AnswerRe: which tool can create 16 and 32 bits bitmap? Pin
Hamid_RT17-May-06 20:31
MemberHamid_RT17-May-06 20:31 
QuestionIOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
velayudhan_raj17-May-06 20:18
Membervelayudhan_raj17-May-06 20:18 
AnswerRe: IOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
Laxman Auti17-May-06 20:36
MemberLaxman 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
MemberHamid_RT17-May-06 20:53 
GeneralRe: IOCTL_STORAGE_EJECTION_CONTROL undeclared identifier Pin
velayudhan_raj17-May-06 21:03
Membervelayudhan_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.