$PBExportHeader$w_readcard.srw forward global type w_readcard from window end type type cb_cancel from commandbutton within w_readcard end type type cb_ok from commandbutton within w_readcard end type type sle_cardno from singlelineedit within w_readcard end type type st_1 from statictext within w_readcard end type end forward global type w_readcard from window integer width = 1335 integer height = 424 boolean titlebar = true string title = "请刷卡" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true event ue_recieve ( ) cb_cancel cb_cancel cb_ok cb_ok sle_cardno sle_cardno st_1 st_1 end type global w_readcard w_readcard type variables uo_pbcomm iuo_pbcomm string is_str end variables event ue_recieve();integer li_pos1,li_pos2 sle_cardno.text = iuo_pbcomm.of_read() li_pos2 = pos(sle_cardno.text ,"") li_pos1 = pos(sle_cardno.text ,"") if li_pos1 > 0 and li_pos2 > 0 then sle_cardno.text = mid(sle_cardno.text,li_pos1 + 1,li_pos2 - li_pos1 - 1) end if end event on w_readcard.create this.cb_cancel=create cb_cancel this.cb_ok=create cb_ok this.sle_cardno=create sle_cardno this.st_1=create st_1 this.Control[]={this.cb_cancel,& this.cb_ok,& this.sle_cardno,& this.st_1} end on on w_readcard.destroy destroy(this.cb_cancel) destroy(this.cb_ok) destroy(this.sle_cardno) destroy(this.st_1) end on event open;iuo_pbcomm = create uo_pbcomm iuo_pbcomm.of_setparent(this) if iuo_pbcomm.of_open("COM3","9600,N,8,1") = false then this.title='串口打开错误!' end if end event event close;iuo_pbcomm.of_close( ) destroy iuo_pbcomm end event type cb_cancel from commandbutton within w_readcard integer x = 777 integer y = 184 integer width = 338 integer height = 92 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "取消" boolean cancel = true end type event clicked;close(parent) end event type cb_ok from commandbutton within w_readcard integer x = 215 integer y = 184 integer width = 338 integer height = 92 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "确定" boolean default = true end type event clicked;string ls_cardno sle_cardno.text=trim(ls_cardno) if sys_cardno=ls_cardno then close(parent) else halt end if end event type sle_cardno from singlelineedit within w_readcard integer x = 229 integer y = 48 integer width = 928 integer height = 92 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type st_1 from statictext within w_readcard integer x = 59 integer y = 64 integer width = 178 integer height = 56 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "卡号:" boolean focusrectangle = false end type