Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MScomm class definition
Message
 
À
31/05/2005 14:45:37
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01018748
Message ID:
01018793
Vues:
32
this.Input is belonged to MSComm Control.

Try this:
oForm = CREATEOBJECT("Form1")
oForm.Show()
ON KEY LABEL ESC CLEAR EVENTS
READ EVENTS

**************************************************
*-- Form:         form1 (c:\traff\testcom.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   05/31/05 09:58:13 PM
*
DEFINE CLASS form1 AS form


    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"
    cominput = .F.


    ADD OBJECT olecontrol1 AS olecontrol WITH ;
        Top = 18, ;
        Left = 10, ;
        Height = 100, ;
        Width = 100, ;
        OLECLass = "MSCOMMLib.MSComm.1", ;
        Name = "Olecontrol1"


    PROCEDURE Init
        WITH thisform.Olecontrol1
          .commport = 1
          .settings = '9600,N,8,1'
          .dtrenable = .T.
          .handshaking = 2
          .rthreshold = 1
          .sthreshold = 0
          .rtsenable = .T.
          .portopen = .T.
        ENDWITH
    ENDPROC


    PROCEDURE Destroy
        IF thisform.Olecontrol1.PortOpen
           thisform.Olecontrol1.PortOpen = .f.
        ENDIF
    ENDPROC


    PROCEDURE olecontrol1.OnComm
        *** ActiveX Control Event ***
        IF thisform.COMInput # CHRTRAN(this.Input,CHR(13)+CHR(10)+"*","")
           thisform.COMInput = CHRTRAN(this.Input,CHR(13)+CHR(10)+"*","")
        ENDIF
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
You can change OleControl1 to something more equal name :o))
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform