#DEFINE eol CHR(13)+ CHR(10) SET SAFETY OFF SET RESOURCE OFF _SCREEN.VISIBLE = .F. PUBLIC cinbuffer cinbuffer = "" loserin = NEWOBJECT("MSCOMMLib.MSComm") loinhandler = NEWOBJECT("InComm") lovfpcom = NEWOBJECT("VFPCOM.ComUtil") lovfpcom.bindevents(loserin,loinhandler) * Adjust to suit port requirements WITH loserin .commport = 2 .settings = '9600,N,8,1' .handshaking = 2 .rthreshold = 1 .sthreshold = 0 .rtsenable = .T. .portopen = .T. ENDWITH * Set up loop here to test cinbuffer for eol * If cinbuffer contains eol, process data, * clear cinbuffer, and wait for next line DO WHILE !FILE("c:\stop.txt") IF eol$(cinbuffer) * process data * clear cinbuffer ENDIF * fastdoevents() by DF a better choice in VFP6 doevents ENDDO DO cleanup DEFINE CLASS incomm AS CUSTOM PROCEDURE oncomm DO CASE CASE loserin.commevent <> 2 * Error handling? CASE loserin.commevent = 2 LOCAL numchars WITH loserin cinbuffer = cinbuffer + loserin.INPUT ENDWITH ENDCASE ENDPROC ENDDEFINE PROCEDURE cleanup lovfpcom.unbindevents(loserin,loinhandler) WITH loserin IF .portopen = .T. .rtsenable = .F. .portopen = .F. ENDIF ENDWITH ON KEY LABEL esc RELEASE cinbuffer CLEAR ALL SET SAFETY ON SET RESOURCE ON CANCEL ENDPROCYou will need to adjust your port settings and add appropriate processing in the DO loop. To kill the thing, fire up notepad and save anything to c:\stop.txt and it will exit. As you are using VFP6, see http://www.geocities.com/ResearchTriangle/9834/qgen006.htm for David F's fastdoevents replacement for the above 'doevents' to speed up the processing.