打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
vfp如何使用FOXTOOLS.FLL的OpenComm() 函式
OpenComm() 是可以使用 FOXTOOLS 呼叫的函式。若要開啟 COM 或 LPT 連接埠 FLL。下面是 OpenComm() 的完整說明。
 
用途
OpenComm() 函式會開啟通訊裝置。

函式語法

   OpenComm(<port>, <in_q>, <out_q>)   Argument       Description   -----------------------------------------------------------------   <port>         Points to a null-terminated string that specifies                  the device in the form COM<n> or LPT<n>, where <n>                  is the device number.   <in_q>         Specifies the size, in bytes, of the receiving                  queue. This parameter is ignored for LPT devices.   <out_q>        Specifies the size, in bytes, of the transmission                  queue. This parameter is ignored for LPT devices.				

傳回

如果函式成功,傳回的值會識別開啟裝置。否則,它是小於零。

錯誤

如果函式失敗,它可能會傳回下列的錯誤值的其中一個:
   Value     Meaning   --------------------------------------------------------------------   -12       The device's baud rate is unsupported.   -11       The specified byte size is invalid.   -10       The hardware is not available (is locked by another device).    -5       The default parameters are in error.    -4       The function cannot allocate the queues.    -3       The device is not open.    -2       The device is already open.    -1       The device identifier is invalid or unsupported.				
如果此函式呼叫與同時佇列大小設定為零,則傳回值是-2,如果裝置已經開啟,或-4 如果裝置是不開啟。

註解

Windows 允許 COM 連接埠 1 到 9 及 LPT 連接埠 1 到 3。如果裝置驅動程式不支援通訊連接埠號碼,將會失敗的 OpenComm() 函式。

範例程式碼

下列程式碼範例會使用 OpenComm() 函式和 FOXTOOLS。若要開啟 COM1 的 FLL。(本範例可以在 FOXPROW\GOODIES\FOXTOOLS\DIALER 中找到。PRG。)
   *-------------------- 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"				
附註: Windows 的 Visual FoxPro OpenComm() 函式的適用性,對照 32 位元 Foxtools.fll 傳回的控制碼 RegFN() 呼叫前提是它會傳遞選擇性的第四個引數,也就是 「 使用者。DLL。"以下是範例:
   hnd = RegFN("OpenComm","CCC","I","User.dll")
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
vfp中API的调用(foxtool edderg callfn)
在主程序和表单中添加背景音乐
在vfp中实现表单的输出(一)
VFP应用程序多媒体徽标的实现
Top 100 Tools for Learning 2010 C4LPT
清抄《太乙琅函》
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服