Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird problem with MSCOMM
Message
De
23/03/2004 07:40:07
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Weird problem with MSCOMM
Divers
Thread ID:
00888798
Message ID:
00888798
Vues:
56
Hi,

My application need to communicate with Myfare reader.
Below are part of my code in VFP8. After clicking the
run button, I can't get the reply from the reader at all.

However, if I change the code to Run1 button, which just
sent the command to the reader. After that, click another button,
ShowResult to get the reply, it will work.

What is wrong with my code below.
I am using the Win32 API, sleep function create
the waitsec function. Will this function 'halt'
my application causing the problem ?

Any advise or solution for me. Thank alot.



Procedure OpenCom()
===================
WITH THISFORM
.RThreshold = 1
.InBufferCount = 0
.OutBufferCount = 0
.PortOpen = .T.
ENDWITH


MSComm OnComm Event()
=====================
IF THIS.InBuffer >= 1

cChar = THIS.Input
THISFORM.cBuffer = THISFORM.cBuffer + cChar

IF ETX $ THISFORM.cBuffer
... do other thing
ENDIF

ENDIF


Run Click Button <=== this part not working
================

gMyFare.OpenCom()
gMyFare.SentComm("GETStatus")
gMyfare.WaitSec(500) <=== waitsec is implement using API, Sleep() function
cResult = gMyFare.cBuffer

IF cResult = "OK"
...
ELSE
...
ENDIF


Run1 Click Button <===== working
================

gMyFare.OpenCom()
gMyFare.SentComm("GETStatus")


ShowResult Click Button <===== working, able to get reply after clicking Run1
=======================

cResult = gMyFare.cBuffer

IF cResult = "OK"
....
ELSE
...
ENDIF
Best Regards
Virusim
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform