Thank you Borislav.
But no, the problem is not the time, it should work in less than one second. But i've tried it with 10, 15, 30 seconds and i get the same symptoms.
DOEVENTS didn't work either.
Joaquim
>Maybe 5 seconds are not enough to get responce, when you debug you break the program and time for waiting is increased a little. Also try to put DOEVENTS in that loop.
>
>do while .t.
> ReturnString = thisform.oCom.input
> if at("OK", upper(ReturnString)) > 0
> exit
> endif
> if seconds() > time + 5
> exit
> endif
> DOEVENTS
>enddo
>
>
>
>
>>Hello,
>>
>>I'm trying to send SMS in VFP, and i need the Mscomm ActiveX control to do that.
>>
>>The code i'm using is following:
>>
>>thisform.oCom.Output = "AT" + Chr(13) + Chr(10)
>>thisform.ocom.Refresh
>>time = seconds()
>>do while .t.
>> ReturnString = thisform.oCom.input
>> if at("OK", upper(ReturnString)) > 0
>> exit
>> endif
>> if seconds() > time + 5
>> exit
>> endif
>>enddo
>>?? ReturnString
>>
>>
>>The above code do this:
>> 1) First i send a command to the Phone with 'output' method of the ActiveX
>> 2) Then i wait 5 seconds for a response from the phone (with the 'input' method), that should be something like this: "AT" + chr(13) + chr(10) + "OK" + chr(13)
>> 3) The loop is breaked in 2 ways: the 5 seconds pass away or i get the word 'OK' in the return string from the phone
>>
>>But i get a "strange" behaviour:
>>When i'm debuging this code to see what is wrong, the code works fine and i receive the correct string. When i'm running this code normally i get nothing.
>>
>>Does anyone know why?
>>
>>Thank you,
>>Joaquim