Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
bonjour,
y a t il moyen de dialoguer avec une trame (port série) à partir d'une application powerbuilder ?
si quelqu'un à une réponse ou déjà travaillé sur ce sujet.
Merci
Hors ligne
bonjour, je crois qu'il y a des discussions sur le forum, fais une recherche
Sinon j'ai trouvé un exemple (en espagnol) utilisant l'objet OLE de la bibliothèque MSCOMM32.OCX :
forward global type w_puertoser from window end type type p_help from picture within w_puertoser end type type st_16 from statictext within w_puertoser end type type p_exit from picture within w_puertoser end type type p_1 from picture within w_puertoser end type type ddlb_long from dropdownlistbox within w_puertoser end type type st_15 from statictext within w_puertoser end type type st_14 from statictext within w_puertoser end type type pb_iniciar from picturebutton within w_puertoser end type type st_13 from statictext within w_puertoser end type type pb_aplicar from picturebutton within w_puertoser end type type st_12 from statictext within w_puertoser end type type sle_segs from singlelineedit within w_puertoser end type type st_11 from statictext within w_puertoser end type type pb_transmite from picturebutton within w_puertoser end type type sle_transmite from singlelineedit within w_puertoser end type type st_10 from statictext within w_puertoser end type type st_2 from statictext within w_puertoser end type type st_5 from statictext within w_puertoser end type type st_4 from statictext within w_puertoser end type type st_3 from statictext within w_puertoser end type type st_1 from statictext within w_puertoser end type type lb_entrada from listbox within w_puertoser end type type ole_com from olecustomcontrol within w_puertoser end type type sle_long from singlelineedit within w_puertoser end type type st_9 from statictext within w_puertoser end type type ddlb_hand from dropdownlistbox within w_puertoser end type type st_8 from statictext within w_puertoser end type type ddlb_bits from dropdownlistbox within w_puertoser end type type st_7 from statictext within w_puertoser end type type ddlb_paridad from dropdownlistbox within w_puertoser end type type st_6 from statictext within w_puertoser end type type ddlb_bauds from dropdownlistbox within w_puertoser end type type ddlb_puerto from dropdownlistbox within w_puertoser end type type gb_1 from groupbox within w_puertoser end type end forward global type w_puertoser from window integer width = 3671 integer height = 2436 boolean titlebar = true string title = "ACEDER A PUERTOS SERIE" boolean controlmenu = true boolean resizable = true windowstate windowstate = maximized! long backcolor = 67108864 string icon = "Structure5!" p_help p_help st_16 st_16 p_exit p_exit p_1 p_1 ddlb_long ddlb_long st_15 st_15 st_14 st_14 pb_iniciar pb_iniciar st_13 st_13 pb_aplicar pb_aplicar st_12 st_12 sle_segs sle_segs st_11 st_11 pb_transmite pb_transmite sle_transmite sle_transmite st_10 st_10 st_2 st_2 st_5 st_5 st_4 st_4 st_3 st_3 st_1 st_1 lb_entrada lb_entrada ole_com ole_com sle_long sle_long st_9 st_9 ddlb_hand ddlb_hand st_8 st_8 ddlb_bits ddlb_bits st_7 st_7 ddlb_paridad ddlb_paridad st_6 st_6 ddlb_bauds ddlb_bauds ddlb_puerto ddlb_puerto gb_1 gb_1 end type global w_puertoser w_puertoser on w_puertoser.create this.p_help=create p_help this.st_16=create st_16 this.p_exit=create p_exit this.p_1=create p_1 this.ddlb_long=create ddlb_long this.st_15=create st_15 this.st_14=create st_14 this.pb_iniciar=create pb_iniciar this.st_13=create st_13 this.pb_aplicar=create pb_aplicar this.st_12=create st_12 this.sle_segs=create sle_segs this.st_11=create st_11 this.pb_transmite=create pb_transmite this.sle_transmite=create sle_transmite this.st_10=create st_10 this.st_2=create st_2 this.st_5=create st_5 this.st_4=create st_4 this.st_3=create st_3 this.st_1=create st_1 this.lb_entrada=create lb_entrada this.ole_com=create ole_com this.sle_long=create sle_long this.st_9=create st_9 this.ddlb_hand=create ddlb_hand this.st_8=create st_8 this.ddlb_bits=create ddlb_bits this.st_7=create st_7 this.ddlb_paridad=create ddlb_paridad this.st_6=create st_6 this.ddlb_bauds=create ddlb_bauds this.ddlb_puerto=create ddlb_puerto this.gb_1=create gb_1 this.Control[]={this.p_help,& this.st_16,& this.p_exit,& this.p_1,& this.ddlb_long,& this.st_15,& this.st_14,& this.pb_iniciar,& this.st_13,& this.pb_aplicar,& this.st_12,& this.sle_segs,& this.st_11,& this.pb_transmite,& this.sle_transmite,& this.st_10,& this.st_2,& this.st_5,& this.st_4,& this.st_3,& this.st_1,& this.lb_entrada,& this.ole_com,& this.sle_long,& this.st_9,& this.ddlb_hand,& this.st_8,& this.ddlb_bits,& this.st_7,& this.ddlb_paridad,& this.st_6,& this.ddlb_bauds,& this.ddlb_puerto,& this.gb_1} end on on w_puertoser.destroy destroy(this.p_help) destroy(this.st_16) destroy(this.p_exit) destroy(this.p_1) destroy(this.ddlb_long) destroy(this.st_15) destroy(this.st_14) destroy(this.pb_iniciar) destroy(this.st_13) destroy(this.pb_aplicar) destroy(this.st_12) destroy(this.sle_segs) destroy(this.st_11) destroy(this.pb_transmite) destroy(this.sle_transmite) destroy(this.st_10) destroy(this.st_2) destroy(this.st_5) destroy(this.st_4) destroy(this.st_3) destroy(this.st_1) destroy(this.lb_entrada) destroy(this.ole_com) destroy(this.sle_long) destroy(this.st_9) destroy(this.ddlb_hand) destroy(this.st_8) destroy(this.ddlb_bits) destroy(this.st_7) destroy(this.ddlb_paridad) destroy(this.st_6) destroy(this.ddlb_bauds) destroy(this.ddlb_puerto) destroy(this.gb_1) end on event open;ddlb_puerto.text = ddlb_puerto.text(1) ddlb_bauds.text = ddlb_bauds.text(5) ddlb_paridad.text = ddlb_paridad.text(1) ddlb_bits.text = ddlb_bits.text(1) ddlb_hand.text = ddlb_hand.text(1) ddlb_long.text = ddlb_long.text(2) pb_iniciar.enabled = false end event event timer;int bufflen string car bufflen = ole_com.object.InBufferCount if bufflen > 0 then car = ole_com.object.input lb_entrada.additem(car) end if end event type p_help from picture within w_puertoser integer x = 3168 integer y = 1164 integer width = 110 integer height = 100 string picturename = "help.bmp" boolean border = true borderstyle borderstyle = styleraised! boolean focusrectangle = false end type event clicked;open(w_help) end event type st_16 from statictext within w_puertoser integer x = 1449 integer y = 148 integer width = 818 integer height = 64 integer textsize = -12 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "POWER BUILDER 7.0" boolean focusrectangle = false end type type p_exit from picture within w_puertoser integer x = 3401 integer y = 1576 integer width = 146 integer height = 128 boolean originalsize = true string picturename = "exitdoor.bmp" boolean border = true borderstyle borderstyle = styleraised! boolean focusrectangle = false end type event clicked;close(w_puertoser) end event type p_1 from picture within w_puertoser integer x = 2743 integer y = 36 integer width = 128 integer height = 164 string picturename = "nautilus.bmp" boolean border = true borderstyle borderstyle = styleshadowbox! boolean focusrectangle = false end type type ddlb_long from dropdownlistbox within w_puertoser integer x = 2217 integer y = 808 integer width = 338 integer height = 400 integer taborder = 80 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" string item[] = {"7","8"} borderstyle borderstyle = stylelowered! end type type st_15 from statictext within w_puertoser integer x = 1691 integer y = 824 integer width = 471 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 = "Long. de palabra:" boolean focusrectangle = false end type type st_14 from statictext within w_puertoser integer x = 3067 integer y = 1452 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 = "Inicia lectura" boolean focusrectangle = false end type type pb_iniciar from picturebutton within w_puertoser integer x = 2853 integer y = 1380 integer width = 178 integer height = 136 integer taborder = 90 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" end type event clicked;int segs,lon if pb_iniciar.picturename = "stophand.bmp" then pb_iniciar.picturename = "rayo.bmp" pb_aplicar.enabled = true pb_transmite.enabled = true else lon = integer(sle_long.text) ole_com.object.inputlen = lon segs = integer(sle_segs.text) timer(segs) pb_aplicar.enabled = false pb_iniciar.picturename = "stophand.bmp" pb_transmite.enabled = false end if end event type st_13 from statictext within w_puertoser integer x = 3072 integer y = 908 integer width = 229 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 = "Aplicar" boolean focusrectangle = false end type type pb_aplicar from picturebutton within w_puertoser integer x = 2839 integer y = 872 integer width = 178 integer height = 136 integer taborder = 90 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string picturename = "Chain.bmp" end type event clicked;string pars pars = ddlb_bauds.text+"," CHOOSE CASE ddlb_paridad.text CASE "ninguna" pars = pars+"n," CASE "par" pars = pars+"p," CASE "impar" pars = pars+"e," END CHOOSE pars = pars+ddlb_long.text+","+ddlb_bits.text if ole_com.object.PortOpen then ole_com.object.PortOpen = false ole_com.object.settings = pars ole_com.object.PortOpen = True pb_iniciar.enabled = true pb_iniciar.picturename = "rayo.bmp" pb_transmite.enabled = true end event type st_12 from statictext within w_puertoser integer x = 1687 integer y = 1548 integer width = 411 integer height = 72 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 = "Segs. por ciclo" boolean focusrectangle = false end type type sle_segs from singlelineedit within w_puertoser integer x = 2144 integer y = 1504 integer width = 197 integer height = 96 integer taborder = 100 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "5" borderstyle borderstyle = stylelowered! end type type st_11 from statictext within w_puertoser integer x = 3058 integer y = 1868 integer width = 261 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 = "Transmite" boolean focusrectangle = false end type type pb_transmite from picturebutton within w_puertoser integer x = 3346 integer y = 1860 integer width = 197 integer height = 88 integer taborder = 50 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string picturename = "indicatr.bmp" alignment htextalign = left! end type event clicked;ole_com.object.output = sle_transmite.text end event type sle_transmite from singlelineedit within w_puertoser integer x = 1687 integer y = 1996 integer width = 1865 integer height = 112 integer taborder = 40 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type st_10 from statictext within w_puertoser integer x = 1687 integer y = 1916 integer width = 635 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 = "Caracteres a transmitir:" boolean focusrectangle = false end type type st_2 from statictext within w_puertoser integer x = 2610 integer y = 380 integer width = 233 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 = "Bauds" boolean focusrectangle = false end type type st_5 from statictext within w_puertoser integer x = 1230 integer y = 68 integer width = 1275 integer height = 64 integer textsize = -12 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "MANEJO DE PUERTOS SERIALES" boolean focusrectangle = false end type type st_4 from statictext within w_puertoser integer x = 2766 integer y = 2208 integer width = 859 integer height = 68 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Por: Ing. Adolfo Chairez Gallegos" boolean focusrectangle = false end type type st_3 from statictext within w_puertoser integer x = 119 integer y = 188 integer width = 567 integer height = 68 integer textsize = -11 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Lectura del puerto;" boolean focusrectangle = false end type type st_1 from statictext within w_puertoser integer x = 1691 integer y = 384 integer width = 233 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 = "Puerto" boolean focusrectangle = false end type type lb_entrada from listbox within w_puertoser integer x = 50 integer y = 276 integer width = 1513 integer height = 1896 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type ole_com from olecustomcontrol within w_puertoser event oncomm ( ) integer x = 3177 integer y = 96 integer width = 174 integer height = 152 integer taborder = 20 borderstyle borderstyle = stylelowered! boolean focusrectangle = false string binarykey = "w_puertoser.win" integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 end type type sle_long from singlelineedit within w_puertoser integer x = 2258 integer y = 1324 integer width = 242 integer height = 108 integer taborder = 90 boolean bringtotop = true integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "1" borderstyle borderstyle = stylelowered! end type type st_9 from statictext within w_puertoser integer x = 1682 integer y = 1296 integer width = 530 integer height = 140 boolean bringtotop = true 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 = "Num. de caracteres a leer por cliclo:" boolean focusrectangle = false end type type ddlb_hand from dropdownlistbox within w_puertoser integer x = 2103 integer y = 996 integer width = 480 integer height = 400 integer taborder = 80 boolean bringtotop = true integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" boolean sorted = false string item[] = {"comNone","comXonXoff","comRTS"} borderstyle borderstyle = stylelowered! end type type st_8 from statictext within w_puertoser integer x = 1691 integer y = 1020 integer width = 402 integer height = 76 boolean bringtotop = true 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 = "HandShaking" boolean focusrectangle = false end type type ddlb_bits from dropdownlistbox within w_puertoser integer x = 3013 integer y = 596 integer width = 247 integer height = 400 integer taborder = 70 boolean bringtotop = true integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" boolean sorted = false string item[] = {"1","0"} borderstyle borderstyle = stylelowered! end type type st_7 from statictext within w_puertoser integer x = 2610 integer y = 624 integer width = 361 integer height = 64 boolean bringtotop = true 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 = "Bits de paro" boolean focusrectangle = false end type type ddlb_paridad from dropdownlistbox within w_puertoser integer x = 1993 integer y = 584 integer width = 434 integer height = 424 integer taborder = 60 boolean bringtotop = true integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" boolean sorted = false string item[] = {"ninguna","par","impar"} borderstyle borderstyle = stylelowered! end type type st_6 from statictext within w_puertoser integer x = 1691 integer y = 612 integer width = 242 integer height = 64 boolean bringtotop = true 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 = "Paridad" boolean focusrectangle = false end type type ddlb_bauds from dropdownlistbox within w_puertoser integer x = 2898 integer y = 356 integer width = 549 integer height = 472 integer taborder = 50 boolean bringtotop = true integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" boolean sorted = false string item[] = {"600","1200","2400","4800","9600","19200"} borderstyle borderstyle = stylelowered! end type type ddlb_puerto from dropdownlistbox within w_puertoser integer x = 1943 integer y = 356 integer width = 485 integer height = 480 integer taborder = 40 boolean bringtotop = true integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 string text = "none" boolean sorted = false string item[] = {"COM 1","COM 2","COM 3","COM 4","COM 5"} borderstyle borderstyle = stylelowered! end type type gb_1 from groupbox within w_puertoser integer x = 1632 integer y = 1756 integer width = 1961 integer height = 384 integer taborder = 40 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 = "Transmisión" borderstyle borderstyle = stylelowered! end type
Hors ligne
Merci
je vais essayer de me débrouiller avec ça , si quelqu'un parmi a + d'info je suis preneur
A+
Hors ligne