Article View: borland.public.cppbuilder.nativeapi
Article #13949How to write to USB printer ?
From: Richard Yu
Date: Tue, 09 Sep 2003 18:07
Date: Tue, 09 Sep 2003 18:07
31 lines
1868 bytes
1868 bytes
GetDefaultPrinter(PrinterName, &BytesCopied);//ok
port=PrinterName;
My code works with Network printer and LPT printer, like this:
aPrinterName=PrinterName;
aPSList->Add(" 350 30 moveto ");
aPSList->Add("("+aPrinterName+")"+" show");
aPSList->Add("showpage");
buffer = (char *)malloc(PRINT_BUF_SIZE);
OpenPrinterA(port, &printer, NULL);
di.pDocName ="";// wbuf;
di.pOutputFile = NULL;
di.pDatatype = TEXT("RAW");
StartDocPrinter(printer, 1, (LPBYTE)&di);
for(int i=0;i< aPSList->Count;i++)
{
aLine=aPSList->Strings[i]+" \r\n";
buffer=aLine.c_str();
WritePrinter(printer, (LPVOID)buffer, aLine.Length(), &written);
}
EndDocPrinter(printer);
ClosePrinter(printer);
when try on USB printer, nothing happened , don't know why ?
Technical Details
Message-ID:
<3f5e16de@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,1ae13809a0049856,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-09 11:09:44 PST From: "Richard Yu" <richard@colorselector.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: How to write to USB printer ? Date: Tue, 9 Sep 2003 11:07:11 -0700 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 24.207.7.224 Message-ID: <3f5e16de@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1063130846 24.207.7.224 (9 Sep 2003 11:07:26 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail