求Mscomm32.ocx例子

newsweetheart 2006-02-17 10:06:41
想用Mscomm32.ocx实现串口收发16进制数,请高手给个16进制的例子,谢谢!
...全文
334 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
CQP 2006-03-20
  • 打赏
  • 举报
回复
http://blog.csdn.net/CQP/archive/2006/01/28/589519.aspx
cxwsoftware 2006-03-19
  • 打赏
  • 举报
回复
是一个串口,还是多串口的?
TianChong 2006-03-19
  • 打赏
  • 举报
回复
先要将这个mscomm32控件加入到窗口中,命名为ole_1
代码如上所述
denxiaom 2006-02-22
  • 打赏
  • 举报
回复
在ONCOMM事件中
If ole_1.object.commevent=2 then
string ls_t,ls_Start
ls_t = ole_1.object.input
ls_start = mid(ls_t,pos(ls_t,'+')+1,6)
st_1.text = ls_start
ole_1.Object.InBufferCount = 0
end if
怎么取字符根据具体情况来定
denxiaom 2006-02-22
  • 打赏
  • 举报
回复
int li_Port,li_commport
boolean lb_State
integer li_rthreshold
string ls_settings

li_commport = integer(ProfileString(gs_directory+"\BalanceSet.ini","Tare","commport",""))
ls_settings = ProfileString(gs_directory+"\BalanceSet.ini","Tare","setting","")
li_rthreshold = integer(ProfileString(gs_directory+"\BalanceSet.ini","Tare","rthreshold",""))
li_Port = ole_1.object.commport
lb_State = ole_1.object.portopen

if li_Port<>li_commport then
ole_1.object.commport=li_commport
end if

ole_1.object.settings=ls_settings

if ole_1.object.portopen = false then
ole_1.object.PortOpen = true
end if

ole_1.object.rthreshold= li_rthreshold //这是设定当串口中的数据达到16个字符的时候串口触发ole_comm.object.CommEvent事件可以用 choose case ole_comm.object.CommEvent case 2捕捉到
ole_1.object.inputlen=0 //初始化Input
ole_1.object.inputmode=0 //0为文本方式,1为二进制方式捡取回数据
hygougou 2006-02-20
  • 打赏
  • 举报
回复
搜搜老帖子~
newsweetheart 2006-02-20
  • 打赏
  • 举报
回复
自己顶,ding,高手呢~~~~

681

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder API 调用
社区管理员
  • API 调用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧