Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get return string from MSCOMM
Message
From
10/02/2003 17:11:17
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
 
 
To
10/02/2003 13:51:56
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00751209
Message ID:
00751673
Views:
12
Jim, I have problems with the values in variables, when I
get the return string form the modem.

I made a simple form for test...
* Form's method's

PROCEDURE INIT
_VFP.AUTOYIELD=.F.
WITH THISFORM.ocxCOMM
	.InputMode = 0
	.RThreshold = 1
	.SThreshold = 1
	.Settings = [9600,n,8,1]
	.RTSEnable = .F.
	.InputLen = 0
ENDWITH
* InputMode = comInputModeBinary = 1
* InputMode = comInputModeText = 0 (default)

ENDPROC
* ---------------------------
PROCEDURE waitforresponse
LPARAMETERS lnDelayInSeconds

LOCAL lnStartTime
lnStartTime = SECO()

DO WHILE SECO() <= (lnStartTime + lnDelayInSeconds) ;
		AND NOT SECO() < lnStartTime
	DOEVENTS()
ENDDO

ENDPROC

* ---------------------------
* OCX method

PROCEDURE OnComm
*** ActiveX Control Event ***
IF THIS.commevent = 2
LOCAL InString
InString = ""
	IF THIS.InBufferCount > 5
		InString =  InString + THIS.INPUT
		RETORNO_MODEM = InString
	ENDIF
ENDIF

ENDPROC

* ---------------------------
* Button 

PROCEDURE CLICK
PUBLIC lcRETORNO_MODEM
LOCAL lcModelo_modem, lcHabilitado_p_bina

IF THISFORM.ocxCOMM.PortOpen
	THISFORM.ocxCOMM.PortOpen = .F.
ENDIF
* SET STEP ON

WITH THISFORM
	.ocxCOMM.CommPort = 3
	.ocxCOMM.PortOpen = .T.
	.ocxCOMM.OUTPUT = [ATI0] + CHR(13)
	.waitforresponse(1)
ENDWITH

lcModelo_modem = RETORNO_MODEM

IF THISFORM.ocxCOMM.PortOpen
	THISFORM.ocxCOMM.PortOpen = .F.
ENDIF

WITH THISFORM
	.ocxCOMM.CommPort = 3
	.ocxCOMM.PortOpen = .T.
	.ocxCOMM.OUTPUT = [AT#CID=1] + CHR(13)
	.waitforresponse(2)
ENDWITH

lcHabilitado_p_bina = RETORNO_MODEM
If I enable the line with SET STEP ON the variables
lcModelo_modem and lcHabilitado_p_bina have the right values that I expect,
but if I disable SET STEP ON line, both variables have the old value ??

Why, I'm going crazy with this ....

Thanks in advance

Peter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform