| 发表于:2008-01-11 16:47:08 楼主 |
发送按钮的代码如下: procedure tform1.button1click(sender: tobject); var lv_str, lv_localhostname, lv_localhostip: string; begin lv_localhostname := pv_getlocalname; //取得本地计算机名 showmessage(lv_localhostname); lv_localhostip := pv_nametoip(lv_localhostname); showmessage(lv_localhostip); adodataset2.filtered := true; adodataset2.filter := format('userip' + '=' + '''%s''', [lv_localhostip]); gv_name := adodataset2.fieldbyname('username').asstring; idudpclient1.host := gv_ip; showmessage(gv_ip); if length(memo2.lines.gettext) > 0 then begin idudpclient1.send(memo2.lines.gettext); lv_str := idudpclient1.receivestring; // 用showmessage(lv_str)发现总是空的,是什么原因,麻烦大家指点,谢谢 memo1.lines.insert(0, gv_name + ': ' + lv_str); memo2.clear; memo2.lines.clear; end; memo2.setfocus; end; |
|
|
|
|