I tried this a while ago without getting an answer, so I'll give it one more try.
I am trying to communicate with a serial printer using the mscomm.ocx ActiveX control. I need to query the printer for the cash drawer open/close status. I am having a problem because I need to have a printer driver attached to the port to send receipts to the printer, however, the mscomm control fails to open the port if there is a printer driver assigned to the port.
When I have my receipt printer driver assigned to the COM port, the following code gives me an error on the .PortOpen = .t. command. It works properly if the printer driver is not assigned to the port.
Here is the text of the error:
OLEIdispatch exception code 0 from MSComm: Could not set comm state, there may be one or more invalid communications parameters...
The .net framework system.io.port object seems to have the same problem.
Here is the code (mycomm.vcx is a wrapper to get around licensing issues):
SET CLASSLIB TO MYCOMM.VCX ADDITIVE
MCOMMOBJ = CREATEOBJECT("MYCOMM")
WITH MCOMMOBJ.MYCOMM
.RThreshold = 1
.SThreshold = 1
.Settings = [9600,n,8,1]
.RTSEnable = .t.
.InputLen = 0
.CommPort = 1
.PortOpen = .T.
ENDWITH
Is there a way I can make this work and keep the printer driver assigned?
Thanks!