General information
Category:
Coding, syntax & commands
>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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only