使用PB开发网络版的来电管理软件 |
chen在2007/8/5发表,被浏览6245次
|
适合对象:记得来电显示管理器的网络版 开发环境:PowerBuilder 下载范例:JDDemo2.pbl.zip 使用环境:需要来电监听服务程序TeleListen.exe(点击下载) 相关连接:来电管理器服务程序
注意:采用Socket网络技术,需要使用ActiveX控件MSWINSCK.OCX 方法:选择“Insert”-〉“Control”-〉“OLE...”-〉“Insert Object”-〉“Insert Control”-〉“Microsoft WinSock Control”
?Generated Application Objectforward global type jddemo2 from application end type global transaction sqlca global dynamicdescriptionarea sqlda global dynamicstagingarea sqlsa global error error global message message end forward global type jddemo2 from application string appname = "jddemo2" string displayname = "来电显示客户端" end type global jddemo2 jddemo2 on jddemo2.create appname="jddemo2" message=create message sqlca=create transaction sqlda=create dynamicdescriptionarea sqlsa=create dynamicstagingarea error=create error end on on jddemo2.destroy destroy(sqlca) destroy(sqlda) destroy(sqlsa) destroy(error) destroy(message) end on event open;Open(Form2) end event
?来电显示客户端 forward global type form2 from window end type type cb_2 from commandbutton within form2 end type type cb_1 from commandbutton within form2 end type type sle_2 from singlelineedit within form2 end type type st_2 from statictext within form2 end type type st_1 from statictext within form2 end type type sle_1 from singlelineedit within form2 end type type lb_1 from listbox within form2 end type type ole_1 from olecustomcontrol within form2 end type end forward global type form2 from window integer width = 1609 integer height = 1048 boolean titlebar = true string title = "来电显示客户端" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 cb_2 cb_2 cb_1 cb_1 sle_2 sle_2 st_2 st_2 st_1 st_1 sle_1 sle_1 lb_1 lb_1 ole_1 ole_1 end type global form2 form2 on form2.create this.cb_2=create cb_2 this.cb_1=create cb_1 this.sle_2=create sle_2 this.st_2=create st_2 this.st_1=create st_1 this.sle_1=create sle_1 this.lb_1=create lb_1 this.ole_1=create ole_1 this.Control[]={this.cb_2,& this.cb_1,& this.sle_2,& this.st_2,& this.st_1,& this.sle_1,& this.lb_1,& this.ole_1} end on on form2.destroy destroy(this.cb_2) destroy(this.cb_1) destroy(this.sle_2) destroy(this.st_2) destroy(this.st_1) destroy(this.sle_1) destroy(this.lb_1) destroy(this.ole_1) end on type cb_2 from commandbutton within form2 integer x = 1125 integer y = 708 integer width = 402 integer height = 112 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "关闭" end type event clicked; ole_1.Object.Close() lb_1.AddItem("已关闭连接") end event type cb_1 from commandbutton within form2 integer x = 1125 integer y = 556 integer width = 402 integer height = 112 integer taborder = 20 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "连接" end type event clicked; ole_1.Object.RemoteHost = sle_1.Text ole_1.Object.RemotePort = Integer(sle_2.Text) ole_1.Object.Connect() end event type sle_2 from singlelineedit within form2 integer x = 1129 integer y = 376 integer width = 402 integer height = 112 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "3825" borderstyle borderstyle = stylelowered! end type type st_2 from statictext within form2 integer x = 1138 integer y = 300 integer width = 402 integer height = 64 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Socket端口" boolean focusrectangle = false end type type st_1 from statictext within form2 integer x = 1129 integer y = 44 integer width = 402 integer height = 64 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "服务器地址" boolean focusrectangle = false end type type sle_1 from singlelineedit within form2 integer x = 1129 integer y = 124 integer width = 402 integer height = 112 integer taborder = 20 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "127.0.0.1" borderstyle borderstyle = stylelowered! end type type lb_1 from listbox within form2 integer x = 37 integer y = 44 integer width = 1019 integer height = 792 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 boolean sorted = false borderstyle borderstyle = stylelowered! end type type ole_1 from olecustomcontrol within form2 event ocx_error ( integer number, string description, long scode, string source, string helpfile, long helpcontext, boolean canceldisplay ) event dataarrival ( long bytestotal ) event ocx_connect ( ) event connectionrequest ( long requestid ) event ocx_close ( ) event sendprogress ( long bytessent, long bytesremaining ) event sendcomplete ( ) integer x = 1408 integer y = 860 integer width = 128 integer height = 112 integer taborder = 10 borderstyle borderstyle = stylelowered! boolean focusrectangle = false string binarykey = "form2.win" integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 end type event dataarrival; String s Integer p ole_1.Object.GetData(ref s) If Left(s, 1) = "#" Then p = Pos(s, " ") lb_1.AddItem("来电号码: " + Mid(s, 2, p - 2)) lb_1.AddItem("来电时间: " + Mid(s, p + 1, 19)) else lb_1.AddItem(s) End If end event event ocx_connect; lb_1.Reset() lb_1.AddItem("连接成功") end event
|
|
|
|