Discussion:
How to write to USB virtual printer port
(too old to reply)
Z.K.
2005-11-09 17:05:39 UTC
Permalink
I have a computer without a parallel port, so I bought a usb to parallel
port adapter. Now, I wrote and application for a serial and parallel
port, but if I pass the name of the virtual printer port which is USB002
to my function which uses writefile, I get an error that the port does
not exist. I was wondering if someone could give me some pointers on
how to send data to this usb virtual printer port via an mfc program. I
am not using a printer driver as it is a special printer and will only
take text.

Z.K.
AliR
2005-11-09 20:13:08 UTC
Permalink
What does your CreateFile line look like?

does it look something like this?

CommPort =
CreateFile("\\\\.\\USB002",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,F
ILE_FLAG_OVERLAPPED,NULL);

AliR.
Post by Z.K.
I have a computer without a parallel port, so I bought a usb to parallel
port adapter. Now, I wrote and application for a serial and parallel
port, but if I pass the name of the virtual printer port which is USB002
to my function which uses writefile, I get an error that the port does
not exist. I was wondering if someone could give me some pointers on
how to send data to this usb virtual printer port via an mfc program. I
am not using a printer driver as it is a special printer and will only
take text.
Z.K.
Z.K.
2005-11-09 23:00:00 UTC
Permalink
It looks like below:

HANDLE hPort;
CString PortName = "USB002";


hPort = CreateFile(PortName,GENERIC_READ|GENERIC_WRITE,0,0,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);

Z.K.
Post by AliR
What does your CreateFile line look like?
does it look something like this?
CommPort =
CreateFile("\\\\.\\USB002",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,F
ILE_FLAG_OVERLAPPED,NULL);
AliR.
Post by Z.K.
I have a computer without a parallel port, so I bought a usb to parallel
port adapter. Now, I wrote and application for a serial and parallel
port, but if I pass the name of the virtual printer port which is USB002
to my function which uses writefile, I get an error that the port does
not exist. I was wondering if someone could give me some pointers on
how to send data to this usb virtual printer port via an mfc program. I
am not using a printer driver as it is a special printer and will only
take text.
Z.K.
Continue reading on narkive:
Loading...