Well , I had managed to write a program - sampling input from a datalogger system , with the mscomm32.ocx . but I have few problems with it and I thought maybe you could help , because I have no one to turn to.

My problem with the communication is :

To sample input/s from the datalogger you have to send a binary block cointaining the input/s you want , in return the datalogger send back a binary block cointaining the answer (value) of the input/s you reqested. - all done through the serial port com (1).
Because I want the program to sample all the time I made this block communication in a Do - Loop thing :

Do
Call block_out ' this block contain the data send to datalogger requesting inputs
MSComm1.Output = hb ' the hb is an array contain the message
Call delay(0.2) ' wait for 0.2 sec. for the datalogger to send back data
Do While MSComm1.InBufferCount > 0
DoEvents ' this is for letting the mscomm_oncomm event to fire
Loop
ReDim Preserve rcv(f - 1)
Call block_in ' this sub take the rcv array , analyze it and shows the sampled inputs on a textbox
Loop

Private Sub MSComm1_OnComm()

Select Case MSComm1.CommEvent

' when receiving byte - insert to the rcv() array
Case comEvReceive
buf = MSComm1.Input ' the buf declare as variant
rcv = buf

End Select

End Sub


The mscomm has an event called mscomm_oncomm , which fired when you recieve data in the recieve buffer.
My problem started when I use this Do - Loop thing to continue the communication - The mscomm_oncom didn't fire because their is an endless loop (the above code) . So to fix it I use the Doevents command , and it did fix the problem , but then another problem poped up :

Because the Doevents command enable events to happen, than for example when I drag the program form or click on it or any other event that happen while the program runs (even if this event doesn't soppuse to do a thing) the communication stops till this event is finished.

Well I know that its happen because the Doevents command but I can't put it out unless you have a solution.
Maybe I need win32 api calls for communication.
I think that I need this communication to work on a different thread - is it possible ? should I write a dll ?

I will be greatfull if you will help me , because for now I'm stuck with this program and I gess you know the feeling ...

Thanks in advance Tomer ([email protected])