Results 1 to 3 of 3

Thread: stream data through MSComm

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Location
    Milwaukee, Wi
    Posts
    28
    Hi,

    i have been playing with the MScomm control and i have been able to get it to pass data back and forth. But i am not able to get it to process data as it recieves it. let me explain. i built a chat app with two richtext boxes. one for typing your text and one for viewing what the other computer sent. i would like to be able to type a character into the input box and have it be displayed on the remote computer right away. right now, i have to generate an OnComm event to be able to flush the buffer. i tried setting the inbuffersize to 1 and just about everything else i can think of. but i still have to push a button to generate an oncomm event and flush the recieve buffer.

    please tell me if i have to live with it, or is there something i can do?


    Shaba

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    What you can do is sit in a loop

    Code:
      Dim arr() As Byte  
    
      Do
        DoEvents
        
        If (frm.MSComm.InBufferCount > 1) Then
           arr = frm.MSComm.Input
           
           '' convert the array to a string
           '' append the string to a display box
           
        End If
        
      Loop Until False '' or some other condition
    Now all you need to do is handle the sends, which can be done in the KeyPress event
    -Shickadance

  3. #3
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    Hi,

    set your mscomm control to this :

    inbufsiz 1024
    sendbufsize 1024
    rtresh : 1
    do not click any option or handshake
    0 in all the rest.


    Oncomm()

    display = display & com.input

    end Oncomm


    PS do not use Doevents in the Oncomm even because
    your oncomm will be cutted by some other oncomm
    events and the caracters may be misplaced from then
    order you sent it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width