Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong with my code...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
What's wrong with my code...
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01033357
Message ID:
01033357
Vues:
55
Whats wrong with my code below? I got an error after receiving data from com1 and save/display to a listbox..
Need help please.

Im capturing data from a PABX where in I need to record all calls. Does anybody have code like this one? Can you share to me?
PUBLIC oFrmcapture

oFrmcapture=CREATEOBJECT([FORM1])
oFrmcapture.Show
RETURN

DEFINE CLASS FORM1 as FORM

	Height = 258
	Width = 570
	DoCreate = .T.
	AutoCenter = .T.
	BorderStyle = 2
	Caption = [Serial Capture]
	Icon = "Graphics\phone13.ico"
	MaxButton = .F.
	MinButton = .F.
	Visible = .F.
	AlwaysOnTop = .T.
	BackColor = RGB(192,192,255)
	Name = [Form1]
	
	DIMENSION aCommdata[1]
	
	ADD OBJECT LIST1 AS LISTBOX WITH ;
		Top = 10, ;
		Left = 10, ;
		Height = 207, ;
		Width = 550
		
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 224, ;
		Left = 240, ;
		Height = 27, ;
		Width = 108, ;
		FontName = [Tahoma], ;
		Caption = [E\<xit], ;
		Name = [Command1]

	
	ADD OBJECT oCOMM AS MSCOMM_OCX WITH ;
		Top = 101, ;
		Left = 72, ;
		Height = 21, ;
		Width = 38, ;
		Name = [oCOMM]
	
	

	*/* Procedures
	PROCEDURE LOAD
	     IF USED('Pabxdata')
	          SELECT('Pabxdata')
	     ELSE
	          USE pabxdata IN 0 SHARED
	     ENDIF
	ENDPROC
		
	PROCEDURE INIT
	Local lcData, lnStart
		
		WITH THIS.oCOMM
			.CommPort = 1
			.RThreshold = 1
			.SThreshold = 1
			.Settings = [1200,n,8,1]
			.RTSEnable = .F.
			.InputLen = 1
			.PortOpen = .T.	
		ENDWITH
	ENDPROC
	
	PROCEDURE oCOMM.OnComm
		*** ActiveX Control Event ***

		*~ CommEvent = 2 means the control received data.

		*~  Store the data the control received to
		*~  the appropriate array row/column.
		*~  The row/column to store to is determined by
		*~  local variable "lcData" which is set in the init procedure
		

		IF THIS.CommEvent = 2
			THISFORM.aCommdata(lcData) = ;
			THISFORM.aCommdata(lcData) + THIS.INPUT
			
			SELECT('Pabxdata')
			APPEND Blank
			Replace serial_dat WITH lcData
			lcData = SPACE(70)
			THISFORM.LIST1.INTERACTIVECHANGE()
		ENDIF
	ENDPROC
	
	PROCEDURE INTERACTIVECHANGE
		THISFORM.LIST1.ROWSOURCE = "Pabxdata"
		THISFORM.LIST1.REFRESH()
	ENDPROC

	PROCEDURE command1.Click
		thisform.Release 
	ENDPROC
	
	PROCEDURE DESTROY
		thisform.ocomm.Portopen = .F.
	ENDPROC
	
ENDDEFINE
DEFINE CLASS MSCOMM_OCX AS OLECONTROL
     OLECLASS = [MSCOMMLib.MSComm.1]
ENDDEFINE
Jojo R. dela Cuesta, B.Sc.
eConsultant, Programmer
Dalplus Technologies
http://www.dalplus.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform