| 发表于:2007-04-06 11:33:439楼 得分:0 |
刚才找了个api的触发机制的例子看了下,总是出现问题,在第一次打开串口的时候没有问题,关闭后再打开就不行了。查看问题出错在createfile中,返回值-1 comnum = createfile(comnumber, &hc0000000, 0, 0, 3, 0, 0) if comnum = -1 then msgbox "com port " & comnumber & " not available. use serial settings (on the main menu) to setup your ports. ", 48 initcom = false exit function end if 关闭串口的代码如下: 这是关闭串口的函数--- public function fincom() on error resume next commtime.enabled = false set commtime = nothing fincom = closehandle(comnum) comisopen = false if err.number <> 0 then err.clear end function 调用该函数---- arccomm1.fincom setcontrollslockstatus "close ", true setcontrollslockstatus "open ", false | | |
|