
printing and talking with a serial pos printer, changing the port of a printer
Hi, my name is Andrew and I have the following situation:
I have to print at several different serial printers (a pos solution). The
special sequences for the printers are stored in a database. In fact I only use
Windows printing because of the spooler. ( I print directly like you can see it
in any store when you pay sth (for example a supermarket))
My problem is that I have to 'talk' with the printer too, and get several status
information of the printer. This would be easy since these sequences are also
stored in my database, but I can only talk to the printer via creating a dynamic
MsComm element (then it s easy). To open the the MsComm element the port of the
printer should be changed to - let s say - FILE: - talk with the printer - and
then close the MsComm element, delete it, change the printer's port to COMx: back
again and print via the windows spooler.
How can I achieve this ? Talking to the printers is only possible via special
APIs for each printer (Epson has one, Star too, HP and so on, and of course I
want a general way (which my way would be if it would work)
So the only questions is: How to change a printer's port ?
My tries went into - OpenPrinter - GetPrinter API calls direction, unfortunately
I didnt find any examples neither in msdn itself nor on the platform sdk.
(Another question I dontz understand is how to pass a structure's address to
another structure as necessary with the DEVMODE address in the PRINTER_INFO_2
structure ??)
Thank you for every kind of help !
Anthe