How to Use WriteComm() and CloseComm() with FOXTOOLS.FLLID: Q105011
|
WriteComm() is a function that can be called using FOXTOOLS.FLL in order to write to the COM or LPT ports. CloseComm() is another function that can be called using FOXTOOLS.FLL in order to close the COM or LPT ports. Below are complete descriptions of WriteComm() and CloseComm().
For information about using the serial port using Visual FoxPro, please see the following article in the Microsoft Knowledge Base:
Q139526 How to Send to the Serial Port by Using Mscomm32.ocx
Argument Description
----------------------------------------------------------------
<comm_id> Specifies the device to receive the bytes. The
OpenComm() function returns this value.
<str> Points to the buffer that contains the bytes to be
written. This is the variable s in the example
below.
<str_len> Specifies the number of bytes to be written.
Argument Description
-------------------------------------------------------------------
<comm_id> Specifies the device to be closed. The OpenComm()
function returns this value. In the example below
this is the variable com1.
*-------------------- dialer.prg ------------------------
* Sample program to output to comm port
* Uses FoxTools library for generic DLL access
SET LIBRARY TO SYS(2004)+"foxtools.fll" ADDITIVE
opencomm = REGFN("OpenComm", "CII", "I")
writecomm = REGFN("WriteComm", "ICI", "I")
closecomm = REGFN("CloseComm", "I", "I")
com1 = CALLFN(opencomm, "COM1:", 100, 100)
s = "ATDT 5551212" + chr(13)
=CALLFN(writecomm, com1, s, len(s))
WAIT WINDOW "Press any key to hang up"
s = "ATH0" + chr(13)
=CALLFN(writecomm, com1, s, len(s))
=CALLFN(closecomm, com1)
RELEASE LIBRARY SYS(2004)+"foxtools.fll"
The above information can also be found in the Microsoft Windows Software Development Kit (SDK) "Programmer's Reference Volume 2: Functions" (describes the functions) and the "Programmer's Reference Volume 3: Messages, Structures, and Macros" (describes the returned values). The online Help file for the Professional Version of Visual C++ also contains this information.
Additional query words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a fll dll
Keywords : kbcode FxprgFoxtools
Version : 2.5x 2.6x
Platform : WINDOWS
Issue type :
Last Reviewed: August 9, 1999