Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RS 232 communication
Message
De
21/08/1998 11:29:30
Paul Harker
Harker Enterprises, Inc.
Idaho Falls, Idaho, États-Unis
 
 
À
19/08/1998 21:57:45
Shihchau Tai
Apic Systems Pte Ltd
Singapore, Singapour
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00126848
Message ID:
00128808
Vues:
21
>My MSCOMM32 activeX object gives me a lot of OLE errors. Any explanation?
>
>I am using VFP5 SP3 on NT4 SP3.
>

Try to implement programatically, and step through the debugger. Here is some sample code.

ComForm = CREATEOBJECT('Form') &&Create Form
ComForm.AddObject("Comm2","olecontrol","mscommlib.MSComm") &&Add control

*If you get an error adding the control, re-install MSCOMM32.OCX with REGSRV.EXE
*---Comm Settings
ComForm.Comm2.CommPort = 2 &&Set comm port
* 9600 baud, no parity, 8 data, and 1 stop bit.
ComForm.Comm2.Settings = "9600,N,8,1"
* Set the input buffer size
ComForm.Comm2.InBufferSize=4096
ComForm.Comm2.ParityReplace="" &&Bug: Garbage in Input Buffer when InBufferSize>2048")
* Tell the control to read entire buffer when Input is used.
ComForm.Comm2.InputLen = 0
*Communications handshaking set to RTS/CTS and XON/XOFF")
ComForm.Comm2.Handshaking=4

*---Open the port.
*---Check if commport is already active.
IF ComForm.Comm2.PortOpen=.F.
ComForm.Comm2.PortOpen = .T.
ENDIF

*---Establishes Communication
ComForm.Comm2.DTREnable=.T. &&Set DTR enabled
ComForm.Comm2.RTSEnable=.T. &&Set RTS enabled - Forces port open
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform