cdholding image

comm32 home
comm32 forum
buy comm32

Introduction
Install Comm32
Why Not MsComm?

Properties
   .Break
   .CDHolding
   .CommEvent
   .CommPort
   .CTSHolding
   .DSRHolding
   .DTREnable
   .EOFEnable
   .Handshaking
   .InBufferCount
   .InBufferSize
   .Input
   .InputLen
   .InputMode
   .NullDiscard
   .OutBufferCount
   .OutBufferSize
   .OutPut
   .ParityReplace
   .PortOpen
   .RThreshold
   .RTSEnable
   .Settings
   .STHreshold


Comm32 Properties
   .DeviceName
   .EOFChar
   .EvtChar
   .EvtCharEnable
   .OutPutEx
   .OutPutMode
   .ParallelEnable
   .TxTimeout

Comm32 Functions
   .getByte

   .GetPortStatus
   .InstalledDrivers
   .putByte
   .PortExists
   .ReadBytes
   .ReadString
   .WriteBytes
   .WriteString

OnComm Event
Hardware/Cables etc

WriteString
WriteBytes

writeString writes a character string into the transmit buffer.
writeBytes writes an array of bytes.

Not available at design time.

Only available with Comm32. Not available with MSComm32 (See remarks below)

         Syntax result = object.WriteString(svalue)
result = object.WriteBytes(bvalue)
     
  object Name of the communications control.
  svalue

WriteString. A String containing the characters to place into the transmit buffer.

  bvalue WriteBytes. An array of bytes
  result Number of characters/bytes that were successfully placed into the transmit buffer.
     
  Example.  
    n = object.WriteString(Text1.Text) '// Places the contents of a text box
'// into the transmit buffer.
'// n contains the number of characters
'// that were successfully placed into the
'// transmit buffer
      '// SEE REMARKS BELOW

Remarks:

If you've used MSComm32 before then you will have used the .Output property. It is the only way that MSComm can transmit data.

One problem with the standard Output property is that it doesn't give any indication of the success or failure of the operation. For reasons of backward compatibility our Comm32 ocx supports the same 'simple' .Output property but we've added new WriteString and WriteBytes functions.

These new functions return the number of characters or bytes that were successfully written to the transmit buffer.

These are Functions so the syntax can therefore not be the same as that of a property.

The standard Output property is used like this:-

      Comm.Output = someString

The writeString function is used like this:-

      n = Comm.WriteString ( someString )

The return value n is the number of characters that were successfully written into the transmit buffer. This may be fewer than you originally tried to send - or even zero - for example if the transmit buffer was full. You can now use n to rearrange the string and output any remaining characters again.

If TxTimeout is zero then the Output/write functions return immediately allowing your application to carry on while the data is transmitted in a separate thread. You can be notified via the OnComm event when transmission is completed.

If TxTimeout is greater than zero then all output/write functions will not return until the required number of chars/bytes have been transmitted or when TxTimeout occurs. (The writeString return value indicates the number of characters that were transmitted allowing you to retry the remaining chars)

 

 

Copyright (c) 2010 Axis Controls Ltd