Information générale
Catégorie:
Contrôles ActiveX en VFP
Titre:
Using MSCOMM32.OCX in VFP
Versions des environnements
Network:
Windows 2000 Server
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement