Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using MSCOMM32.OCX in VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Using MSCOMM32.OCX in VFP
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01117001
Message ID:
01117001
Vues:
308
Dear All,

I am writing a code to send and receive data on a machine connected on com port. By looking on the manual of machine I understood what i need to send (eg. U010000000) and what the machine will send back (eg. 010000001001).

After using the MSCOMM32 control (object name on FORM is MSCOM1) I have written following code in the RECEIVE event (MSCOM1.ONCOMM()):
cRetCode = cRetCode + MSCOM1.INPUT

For sending the output I have following line of code:
MSCOM1.OUTPUT = 'U010000000'

The above statement send the correct instructions to machine and it starts working correctly.

Now I have written following statement to verify the return value:
IF cRetCode = "010000001001"
MESSAGEBOX("Commands Successfull")
ENDIF

When program executes it does not show me the message box.

But if I use a SUSPEND statement before checking the value of cRetCode then it gives me correct value.

The RThreshold value for MSCOM1 is set to 1. As there are cases when the machine will send only 1 or two characters and I need to process that also.

If anybody has done this type of work then please help me.

Thanks,
Rajeev
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform