Convertir este Codigo

Solicito ayuda de un experto en VB/VFP para convertir el siguiente codigo de VB a Visual Foxpro.
Private Sub Form_Load ()
' Buffer to hold input string
Dim Instring As String
' Use COM1.
MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input is used.
MSComm1.InputLen = 0
' Open the port.
MSComm1.PortOpen = True
' Send the attention command to the modem.
MSComm1.Output = "ATV1Q0" & Chr$(13) ' Ensure that the modem responds with "OK".
' Wait for data to come back to the serial port.
Do
DoEvents
Buffer$ = Buffer$ & MSComm1.Input
Loop Until InStr(Buffer$, "OK" & vbCRLF)
' Read the "OK" response data in the serial port. Close the serial port.
MSComm1.PortOpen = False
End Sub
Respuesta
1
checa esto, a ver si sirve...
Funciona mediante el MS Comm Control (MSCOMM32.OCX)
Para hacer esto hay que tener registrado el MSCOMM32.OCX.
Luego agregamos el activeX al formulario y en el evento Click de un botón (o en elo LOAd del formulario) escribimos:
Local cValor
With thisform
.olecontrol1.commport = 1
.olecontrol1.settings = "9600,N,8,1" &&aunque la 'N', podria ser en minuscula ("n").
.olecontrol1.inputlen = 0
.olecontrol1.portopen = .t.
.olecontrol1.Output = "ATV1Q0" + Chr(13)
cValor = ""
DO WHILE NOT (("OK" + vbCRLF) $ cValor)
cValor = cValor + .comport.input
ENDDO
.olecontrol1.portopen = .f.
Endwith
No recuerdo para que sirve 'vbCRLF', porlo que hay sustituirlo por su valor.
Tal vez no funcione al 100%, pero seria una ayuda para empezar
César Pech.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas