Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use COM1 or COM2 in VFP 5
Message
 
À
28/12/1997 23:36:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00068184
Message ID:
00069769
Vues:
177
>I want to write some data to a datacard machine through communication port,
>I use function FOPEN to open the port
> FOPEN("COM1", 12)
>however, it always returns the value -1. And I can't find any other
>information about
>the communication port in the help file.
>My questions are how to open a COM port in VFP 5 and how to write data to
>it.
>
>Thanks !

You cannot write to the comm port in this fashion. (In Fox Dos.. this was a way.)

Instead you have to use the mscomm control.
Basically you place the ole object (mscomm.ocx) on your form.
It has properties for setting the port, etc.
Once the comm parameters are set and the port has openned successfully, you send strings out of the port via its output property.
i.e.
If the name of the control is mycomm
then
mycomm.output='HI' will send Hi out the comm port you set in your setup.

See the VFP help file under OLE controls and MSComm for more info.

Mike
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform