Pb发送1.txt 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 一、客服组件的安装
  2. 1.把MWGateway.dll放到Windows的安装目录,如:C:\Windows\
  3. 2.打开“运行”对话框:在“开始”菜单中点击“运行”菜单,打开“运行”对话框
  4. 3.注册客服组件
  5. 在“运行”对话框的输入框中输入:regsrv32 "组件dll路径\MWCom.dll"
  6. 其中 客服组件dll路径为 MWCom.dll文件所在的目录全称 如:c:\MW
  7. ****************************特别说明****************************
  8. 1.使用Http方式连接到平台,请使用 server1.montnets.com:80
  9. 2.使用Http方式连接到服务器,必须使用所有以"Http"结尾的方法
  10. 3.使用socket4,socket5,http代理连接服务器时候,服务器要设置成 "61.242.89.115"
  11. ****************************************************************
  12. 二、 组件函数调用说明
  13. 变量定义:
  14. lb_1:listbox;
  15. demo:OLEObject;
  16. 初始化:
  17. demo = CREATE OLEObject
  18. demo.ConnectToNewObject("MWCom.clscom")
  19. //-----------------------------------连接函数----------------------------------//
  20. int li_port =8018;
  21. string ls_telphone = '13888888888'; //账号
  22. string ls_password = '807778'; //密码
  23. long li_conn_int;
  24. ls_ip='server1.montnets.com';
  25. ls_telphone='13811111112';
  26. ls_password='123456';
  27. cb_1.enabled = false;
  28. li_conn_int = demo.MWconnect(ls_ip,li_port,ls_telphone,ls_password);
  29. if li_conn_int>0 then
  30. lb_1.additem('和梦网平台连接成功,现在可以正常的发送信息和接收信息!');
  31. else
  32. lb_1.additem('和梦网平台连接失败,请检查网络是否通畅!');
  33. end if
  34. //-----------------------------------接收函数----------------------------------//
  35. event clicked;//接收信息,首先得到信息的条数
  36. long li_news_count;
  37. long i;
  38. string ls_news_content;
  39. if li_news_count>0 then
  40. lb_1.additem('系统正在接收信息:已获取信息条数'+string(li_news_count)+'条');
  41. for i = 0 to li_news_count -1
  42. ls_news_content = demo.MWGetRcvdMsg(i);
  43. lb_1.additem('第'+string(i+1)+'条信息内空为:'+ls_news_content);
  44. next
  45. else
  46. lb_1.additem('系统暂时没有上行信息');
  47. end if
  48. //-----------------------------------发送函数----------------------------------//
  49. string ls_telphone='13534***346' //接收方手机号码
  50. string ls_newscode ;
  51. string ls_news = '欢迎你使用短消息发送程序!' //要发送的信息内容
  52. long li_return_int //fun return value
  53. //li_return_int = demo.MWSendMsg(ls_telphone, ls_news);//发送单向信DAT* 4 ?息
  54. li_return_int = demo.MWCsSendMsg(ls_telphone, ls_news,1);//发送客服信息
  55. if li_return_int = 1 then
  56. ls_newscode = demo.MWCsMsgID();
  57. lb_1.additem('信息提交成功!'+'当前的信息编号为:'+ls_newscode);
  58. else
  59. if (li_return_int = -1 or li_return_int = -1 or li_return_int = 0) then
  60. lb_1.additem('信息提交失败!');
  61. else
  62. lb_1.additem('连接中断,系统正在进行重新连接...!');
  63. li_return_int = demo.MWReConnect();
  64. if li_return_int<=0 then
  65. lb_1.additem('重新连接失败,请你检查网络是否通畅...!')DAT* 6 ?;
  66. else
  67. lb_1.additem('重新连接成功,系统可以正常的发送信息和接收信息!');
  68. end if
  69. end if