I hope someone can point me in the correct direction regarding the
printing problem I am having below:
Setup:
Win CE 5.0 with all QFEs installed to Jan '09
GENE 6315 board with Via Mark processor
Debug image with KITL enabled
>>Trying to print from a custom application.
I have written a very simple printing class in my application that
uses the pcl driver and prints to a HP USB printer. The printing
aspect is fine under normal circumstances, but I cannot see an obvious
way to handle error conditions such as no paper in printer etc.
I am doing something like this (general error checking and other
details removed for clarity):
// Get a DC to the printer. If printer isn't powered this will fail -
can print error stating "printer not found" or similar
hdcPrinter = CreateDC(TEXT("pcl.dll"), TEXT("Deskjet 460"), TEXT
("LPT1:"), &m_dmPrintMode);
// Set a callback to allow a "cancel" dialog
SetAbortProc( hdcPrinter, PrinterStatus)
// Signal the start of a document
StartDoc(hdcPrinter, &docInfo)
// Signal the start of a page
StartPage(hdcPrinter)
// Prepare the page to print/formatting etc
// Finished preparing the page
EndPage(hdcPrinter)
// This is the only page we are printing this time
EndDoc(hdcPrinter)
// Return the printer DC to the system as we are finished with it now.
DeleteDC(hdcPrinter);
Looking through the CE source I can see that the prnport.c [C:
\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\PRINTER\PRNPORT.c] file handles
the error conditions I am trying to access but it sends the output to
a dialog through the ReportPrinterStatus() function. I don't want any
windows error dialogs - I want to handle this in my app and format the
message to match the rest of my GUI.
I can see through PB that if the printer is opened with PrinterOpen()
and I have a handle to the printer I can use DEV_IO_CONTROL calls to
get the printer status, but if I get a printer DC from pcl.dll I
believe (maybe incorrectly?) that I am a level up from there (i.e.
pcl.dll makes the calls to PrinterOpen() etc). How can I get error
messages in this case or should I forget pcl.dll and make the calls in
my app myself?
Thanks for any help you can provide,
-- keano
Can anybody comment on this please? Is there another approach I could
take?
Thanks,
--keano
I also have this problem with my application. Can anybody help please?