Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem opening serial port with printer driver attached
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Problem opening serial port with printer driver attached
Divers
Thread ID:
01197511
Message ID:
01197511
Vues:
66
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

*
* Open the rs232 port
* Load mscomm
*

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!
Paul R. Moon
Business Software Solutions
paul@businessoftware.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform