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