[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SetCommState( cDCB )-> <lSuccess>
------------------------------------------------------------------------------


 PARAMETER:

  <cDCB>    Is a string containing a DCB ( Device Control block ) structure. 
            The DCB structure is created by using BuildCommDcb()


 RETURNS:

  <lSuccess> is TRUE if the function is successful



 DESCRIPTION:

  SetCommState() sets a communications device to the state specified by a
  device control block. This function reinitializes all hardware and
  controls as defined by the DCB structure, but it does not empty the
  transmission or receiving buffers. 
  Look up SAMPLES\TestComm.prg for a working communication sample

 EXAMPLE:


    +--------------------------------------------------------------+
    |  /* Set up the port */                                       |
    |   LOCAL ;                                                    |
    |      cDCB,;                                                  |
    |      nErr                                                    |
    |                                                              |
    |   IF !( nIdComDev = OpenComm("COM1", 1024, 128 )) == 0       |
    |      nErr := BuildCommDCB("COM1:9600,n,8,1", @cDCB)          |
    |                                                              |
    |      IF nErr < 0                                             |
    |         MsgAlert( "Error " + STR( nErr, 2 ), "BuildComm")    |
    |         RETURN 0                                             |
    |      ENDIF                                                   |
    |                                                              |
    |      nErr := SetCommState( @cDCB )                           |
    |      IF nErr < 0                                             |
    |         MsgAlert( "Error " + STR( nErr, 2 ), "SetComm" )     |
    |         RETURN 0                                             |
    |      ENDIF                                                   |
    |                                                              |
    +--------------------------------------------------------------+


 SOURCE:

  SOURCE\WINAPI\COMM.C



See Also: OpenComm BuildCommDCB ReadComm WriteComm CloseComm
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson