Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printer help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi,

With Visual C++, I made a dialog box and I would like
print on my HP laserJet some informations (textes and lines).

I know do it with a SDI but I do my program with dialog.

Has anybody a idea ??

Thank a lot

 
Thank to answer me.

I had already try this way. But I didn't manage to print anything !!
Have you a code sample ??

Thank a lot.

Sèverine
 
Hi,
Try creating a "CPrintDialog", attach the "CDC" U created, then using "TextOut" to
write the text to the printer. [sig][/sig]
 
Here is the code to Access printer from a Dialog Class,

Void CDlgPrintDlg::OnOK()
{
CPrintDialog dlgPrint(FALSE,PD_ALLPAGES,this);

if(dlgPrintl.DoModal()==IDOK)
{
CDC dcPrint;
dcPrint.Attach(dlgPrint.GetPrinterDC());

DOCINFO myPrintJob;
myPrintJob.cbSize = sizeof(myPrintJob);
myPrintJob.lpszDocName = "MyPrintJob";
myPrintJob.lpszOutput = NULL;
myPrintJob.lpszDatatype = NULL;
myPrintJob.fwType = NULL;

if (dcPrint.StartDoc(&myPrintJob)>=0)
{
dcPrint.StartPage();
dcPrint.TextOut(0,0,"My Small Print Job");
dcPrint.EndPage();
dcPrint.EndDoc();
}
dcPrint.DeleteDC();
}
Let me know you have any questions : bharadwajach@hotmail.com

CDialog::OnOK();

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top