Is there a way in Windows (which works in Windows CE) to check if a printer is attached and communicating to LPT1 in C++?
[Edit] More info:
We are currently working with a generic Windows CE printer driver - pcl.dll
- by passing it into CreateDC
, to get the DC for the printer.
We can't call PrintDlg()
to show the print dialog because it is "too complicated looking," but we also can't call it with PD_RETURNDEFAULT
because we do not want to use the default printer. So, we are manually setting up a DEVMODE
structure to pass in to CreateDC
.
After we have the DC, we call GetDeviceCaps()
to get the info for the printer (such as page-width, etc), then StartPage()
/EndPage()
/ExtTextOut()
to print.
However, if there is no printer attached, the program freezes for about a minute before giving an "Abort/retry/fail?" dialog (I don't know what point in this process it is freezing). Other software doesn't freeze when you attempt to print, so there must be a way of preventing this...