Form1.vb 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. Public Class FrmDemo
  2. Inherits System.Windows.Forms.Form
  3. ''MonGatekf.dll
  4. 'Private Declare Function MongateConnect Lib "mongatekf.dll" (ByVal ip As String, ByVal port As Integer, ByVal account As String, ByVal pwd As String) As Integer
  5. 'Private Declare Function MongateDisConnect Lib "mongatekf.dll" (ByVal clientsock As Integer) As Integer
  6. 'Private Declare Function MongateSendSms Lib "mongatekf.dll" (ByVal clientsock As Integer, ByVal mobi As String, ByVal note As String, ByRef msgnumber As Byte) As Integer
  7. ''Private Declare Function MongateSendSingleSms Lib "mongatekf.dll" (ByVal clientsock As Integer, ByVal mobi As String, ByVal note As String, ByRef msgnumber As Byte) As Integer
  8. ''Private Declare Function MongateSendMultSms Lib "mongatekf.dll" (ByVal clientsock As Integer, ByVal mobi As String, ByVal note As String, ByVal mobinum As Integer, ByRef msgnumber As Byte) As Integer
  9. 'Private Declare Function MongateGetSms Lib "mongatekf.dll" (ByVal clientsock As Integer, ByRef recvbuf As Byte) As Integer
  10. Private Declare Function MongateGetStatus Lib "mongatekf.dll" (ByVal clientsock As Integer, ByRef recvbuf As Byte) As Integer
  11. 'MWGateway.dll
  12. Private Declare Function MongateConnect Lib "MWGateway.dll" (ByVal serverip As String, _
  13. ByVal port As Integer, ByVal account As String, ByVal pwd As String) As Integer
  14. Private Declare Function MongateSendSms Lib "MWGateway.dll" (ByVal socket As Integer, _
  15. ByVal mobi As String, ByVal msg As String) As Integer
  16. Private Declare Function MongateTestConn Lib "MWGateway.dll" (ByVal socket As Integer) As Integer
  17. Private Declare Function MongateQueryBalance Lib "MWGateway.dll" (ByVal socket As Integer) As Integer
  18. Private Declare Function MongateQueryUsed Lib "MWGateway.dll" (ByVal socket As Integer) As Integer
  19. Private Declare Function MongateRecharge Lib "MWGateway.dll" (ByVal socket As Integer, _
  20. ByVal cardno As String, ByVal cardpwd As String) As Integer
  21. Private Declare Function MongateChangePwd Lib "MWGateway.dll" (ByVal socket As Integer, _
  22. ByVal account As String, ByVal oldpwd As String, ByVal newpwd As String) As Integer
  23. Private Declare Sub MongateDisconnect Lib "MWGateway.dll" (ByVal socket As Integer)
  24. Private Declare Function MongateVasGetSms Lib "MWGateway.dll" (ByVal socket As Integer, _
  25. ByRef recvmsg As Byte) As Integer
  26. Private Declare Function MongateVasSendSms Lib "MWGateway.dll" (ByVal socket As Integer, _
  27. ByVal feecode As String, ByVal spno As String, ByVal opercode As String, _
  28. ByVal linkid As String, ByVal mobis As String, ByVal msg As String, _
  29. ByVal icount As Integer) As Integer
  30. Private Declare Function MongateCsGetSms Lib "MWGateway.dll" (ByVal socket As Integer, _
  31. ByRef statereport As Byte) As Integer
  32. Private Declare Function MongateCsSendSms Lib "MWGateway.dll" (ByVal socket As Integer, _
  33. ByVal mobi As String, ByVal note As String, ByVal icount As Integer, _
  34. ByRef msgno As Byte) As Integer
  35. Private Declare Function MongateCsGetStatusReport Lib "MWGateway.dll" _
  36. (ByVal socket As Integer, ByRef recvmsg As Byte) As Integer
  37. Dim clientsock As Integer
  38. #Region " Windows 窗体设计器生成的代码 "
  39. Public Sub New()
  40. MyBase.New()
  41. '该调用是 Windows 窗体设计器所必需的。
  42. InitializeComponent()
  43. '在 InitializeComponent() 调用之后添加任何初始化
  44. End Sub
  45. '窗体重写 dispose 以清理组件列表。
  46. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  47. If disposing Then
  48. If Not (components Is Nothing) Then
  49. components.Dispose()
  50. End If
  51. End If
  52. MyBase.Dispose(disposing)
  53. End Sub
  54. 'Windows 窗体设计器所必需的
  55. Private components As System.ComponentModel.IContainer
  56. '注意: 以下过程是 Windows 窗体设计器所必需的
  57. '可以使用 Windows 窗体设计器修改此过程。
  58. '不要使用代码编辑器修改它。
  59. Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
  60. Friend WithEvents CkSingle As System.Windows.Forms.CheckBox
  61. Friend WithEvents CkVas As System.Windows.Forms.CheckBox
  62. Friend WithEvents Ckkf As System.Windows.Forms.CheckBox
  63. Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
  64. Friend WithEvents TxtPort As System.Windows.Forms.TextBox
  65. Friend WithEvents TxtIp As System.Windows.Forms.TextBox
  66. Friend WithEvents Label5 As System.Windows.Forms.Label
  67. Friend WithEvents Label19 As System.Windows.Forms.Label
  68. Friend WithEvents TxtPwd As System.Windows.Forms.TextBox
  69. Friend WithEvents TxtAccount As System.Windows.Forms.TextBox
  70. Friend WithEvents Label2 As System.Windows.Forms.Label
  71. Friend WithEvents Label1 As System.Windows.Forms.Label
  72. Friend WithEvents BtnConn As System.Windows.Forms.Button
  73. Friend WithEvents BtnTest As System.Windows.Forms.Button
  74. Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
  75. Friend WithEvents TxtMsg As System.Windows.Forms.TextBox
  76. Friend WithEvents Label4 As System.Windows.Forms.Label
  77. Friend WithEvents Label3 As System.Windows.Forms.Label
  78. Friend WithEvents BtnDisConn As System.Windows.Forms.Button
  79. Friend WithEvents Btnreport As System.Windows.Forms.Button
  80. Friend WithEvents BtnRecv As System.Windows.Forms.Button
  81. Friend WithEvents BtnSend As System.Windows.Forms.Button
  82. Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox
  83. Friend WithEvents ListInfo As System.Windows.Forms.ListBox
  84. Friend WithEvents GroupBox5 As System.Windows.Forms.GroupBox
  85. Friend WithEvents Label7 As System.Windows.Forms.Label
  86. Friend WithEvents Label8 As System.Windows.Forms.Label
  87. Friend WithEvents TxtCount As System.Windows.Forms.TextBox
  88. Friend WithEvents Label9 As System.Windows.Forms.Label
  89. Friend WithEvents Label10 As System.Windows.Forms.Label
  90. Friend WithEvents TxtPhone As System.Windows.Forms.TextBox
  91. Friend WithEvents Label11 As System.Windows.Forms.Label
  92. Friend WithEvents TxtLinkid As System.Windows.Forms.TextBox
  93. Friend WithEvents TxtFee As System.Windows.Forms.TextBox
  94. Friend WithEvents TxtSPort As System.Windows.Forms.TextBox
  95. Friend WithEvents TxtNewPwd As System.Windows.Forms.TextBox
  96. Friend WithEvents BtnChangePwd As System.Windows.Forms.Button
  97. Friend WithEvents BtnLeft As System.Windows.Forms.Button
  98. Friend WithEvents BtnUsed As System.Windows.Forms.Button
  99. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  100. Me.GroupBox1 = New System.Windows.Forms.GroupBox
  101. Me.Ckkf = New System.Windows.Forms.CheckBox
  102. Me.CkVas = New System.Windows.Forms.CheckBox
  103. Me.CkSingle = New System.Windows.Forms.CheckBox
  104. Me.GroupBox2 = New System.Windows.Forms.GroupBox
  105. Me.BtnDisConn = New System.Windows.Forms.Button
  106. Me.BtnTest = New System.Windows.Forms.Button
  107. Me.BtnConn = New System.Windows.Forms.Button
  108. Me.TxtPwd = New System.Windows.Forms.TextBox
  109. Me.TxtAccount = New System.Windows.Forms.TextBox
  110. Me.Label2 = New System.Windows.Forms.Label
  111. Me.Label1 = New System.Windows.Forms.Label
  112. Me.TxtPort = New System.Windows.Forms.TextBox
  113. Me.TxtIp = New System.Windows.Forms.TextBox
  114. Me.Label5 = New System.Windows.Forms.Label
  115. Me.Label19 = New System.Windows.Forms.Label
  116. Me.GroupBox3 = New System.Windows.Forms.GroupBox
  117. Me.TxtPhone = New System.Windows.Forms.TextBox
  118. Me.Label11 = New System.Windows.Forms.Label
  119. Me.TxtLinkid = New System.Windows.Forms.TextBox
  120. Me.Label10 = New System.Windows.Forms.Label
  121. Me.TxtCount = New System.Windows.Forms.TextBox
  122. Me.Label9 = New System.Windows.Forms.Label
  123. Me.TxtFee = New System.Windows.Forms.TextBox
  124. Me.Label8 = New System.Windows.Forms.Label
  125. Me.Btnreport = New System.Windows.Forms.Button
  126. Me.BtnRecv = New System.Windows.Forms.Button
  127. Me.BtnSend = New System.Windows.Forms.Button
  128. Me.TxtMsg = New System.Windows.Forms.TextBox
  129. Me.TxtSPort = New System.Windows.Forms.TextBox
  130. Me.Label4 = New System.Windows.Forms.Label
  131. Me.Label3 = New System.Windows.Forms.Label
  132. Me.GroupBox4 = New System.Windows.Forms.GroupBox
  133. Me.ListInfo = New System.Windows.Forms.ListBox
  134. Me.GroupBox5 = New System.Windows.Forms.GroupBox
  135. Me.TxtNewPwd = New System.Windows.Forms.TextBox
  136. Me.Label7 = New System.Windows.Forms.Label
  137. Me.BtnChangePwd = New System.Windows.Forms.Button
  138. Me.BtnLeft = New System.Windows.Forms.Button
  139. Me.BtnUsed = New System.Windows.Forms.Button
  140. Me.GroupBox1.SuspendLayout()
  141. Me.GroupBox2.SuspendLayout()
  142. Me.GroupBox3.SuspendLayout()
  143. Me.GroupBox4.SuspendLayout()
  144. Me.GroupBox5.SuspendLayout()
  145. Me.SuspendLayout()
  146. '
  147. 'GroupBox1
  148. '
  149. Me.GroupBox1.Controls.Add(Me.Ckkf)
  150. Me.GroupBox1.Controls.Add(Me.CkVas)
  151. Me.GroupBox1.Controls.Add(Me.CkSingle)
  152. Me.GroupBox1.Location = New System.Drawing.Point(9, 0)
  153. Me.GroupBox1.Name = "GroupBox1"
  154. Me.GroupBox1.Size = New System.Drawing.Size(415, 40)
  155. Me.GroupBox1.TabIndex = 14
  156. Me.GroupBox1.TabStop = False
  157. Me.GroupBox1.Text = "帐户类型"
  158. '
  159. 'Ckkf
  160. '
  161. Me.Ckkf.Location = New System.Drawing.Point(296, 15)
  162. Me.Ckkf.Name = "Ckkf"
  163. Me.Ckkf.Size = New System.Drawing.Size(112, 23)
  164. Me.Ckkf.TabIndex = 18
  165. Me.Ckkf.Text = "客服双向帐户"
  166. '
  167. 'CkVas
  168. '
  169. Me.CkVas.Location = New System.Drawing.Point(156, 15)
  170. Me.CkVas.Name = "CkVas"
  171. Me.CkVas.Size = New System.Drawing.Size(112, 23)
  172. Me.CkVas.TabIndex = 17
  173. Me.CkVas.Text = "增值双向帐户"
  174. '
  175. 'CkSingle
  176. '
  177. Me.CkSingle.Checked = True
  178. Me.CkSingle.CheckState = System.Windows.Forms.CheckState.Checked
  179. Me.CkSingle.Location = New System.Drawing.Point(19, 15)
  180. Me.CkSingle.Name = "CkSingle"
  181. Me.CkSingle.Size = New System.Drawing.Size(112, 23)
  182. Me.CkSingle.TabIndex = 16
  183. Me.CkSingle.Text = "单向帐户"
  184. '
  185. 'GroupBox2
  186. '
  187. Me.GroupBox2.Controls.Add(Me.BtnDisConn)
  188. Me.GroupBox2.Controls.Add(Me.BtnTest)
  189. Me.GroupBox2.Controls.Add(Me.BtnConn)
  190. Me.GroupBox2.Controls.Add(Me.TxtPwd)
  191. Me.GroupBox2.Controls.Add(Me.TxtAccount)
  192. Me.GroupBox2.Controls.Add(Me.Label2)
  193. Me.GroupBox2.Controls.Add(Me.Label1)
  194. Me.GroupBox2.Controls.Add(Me.TxtPort)
  195. Me.GroupBox2.Controls.Add(Me.TxtIp)
  196. Me.GroupBox2.Controls.Add(Me.Label5)
  197. Me.GroupBox2.Controls.Add(Me.Label19)
  198. Me.GroupBox2.Location = New System.Drawing.Point(8, 40)
  199. Me.GroupBox2.Name = "GroupBox2"
  200. Me.GroupBox2.Size = New System.Drawing.Size(416, 73)
  201. Me.GroupBox2.TabIndex = 15
  202. Me.GroupBox2.TabStop = False
  203. Me.GroupBox2.Text = "帐户登陆"
  204. '
  205. 'BtnDisConn
  206. '
  207. Me.BtnDisConn.Enabled = False
  208. Me.BtnDisConn.Location = New System.Drawing.Point(354, 16)
  209. Me.BtnDisConn.Name = "BtnDisConn"
  210. Me.BtnDisConn.Size = New System.Drawing.Size(55, 23)
  211. Me.BtnDisConn.TabIndex = 18
  212. Me.BtnDisConn.Text = "断开"
  213. '
  214. 'BtnTest
  215. '
  216. Me.BtnTest.Location = New System.Drawing.Point(296, 43)
  217. Me.BtnTest.Name = "BtnTest"
  218. Me.BtnTest.Size = New System.Drawing.Size(113, 23)
  219. Me.BtnTest.TabIndex = 17
  220. Me.BtnTest.Text = "测试连接"
  221. '
  222. 'BtnConn
  223. '
  224. Me.BtnConn.Location = New System.Drawing.Point(296, 16)
  225. Me.BtnConn.Name = "BtnConn"
  226. Me.BtnConn.Size = New System.Drawing.Size(55, 23)
  227. Me.BtnConn.TabIndex = 15
  228. Me.BtnConn.Text = "连接"
  229. '
  230. 'TxtPwd
  231. '
  232. Me.TxtPwd.Location = New System.Drawing.Point(212, 42)
  233. Me.TxtPwd.Name = "TxtPwd"
  234. Me.TxtPwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
  235. Me.TxtPwd.Size = New System.Drawing.Size(60, 21)
  236. Me.TxtPwd.TabIndex = 14
  237. Me.TxtPwd.Text = "807778"
  238. '
  239. 'TxtAccount
  240. '
  241. Me.TxtAccount.Location = New System.Drawing.Point(48, 42)
  242. Me.TxtAccount.Name = "TxtAccount"
  243. Me.TxtAccount.Size = New System.Drawing.Size(120, 21)
  244. Me.TxtAccount.TabIndex = 13
  245. Me.TxtAccount.Text = "13888888888"
  246. '
  247. 'Label2
  248. '
  249. Me.Label2.Location = New System.Drawing.Point(176, 44)
  250. Me.Label2.Name = "Label2"
  251. Me.Label2.Size = New System.Drawing.Size(40, 21)
  252. Me.Label2.TabIndex = 12
  253. Me.Label2.Text = "密码:"
  254. '
  255. 'Label1
  256. '
  257. Me.Label1.Location = New System.Drawing.Point(7, 44)
  258. Me.Label1.Name = "Label1"
  259. Me.Label1.Size = New System.Drawing.Size(40, 21)
  260. Me.Label1.TabIndex = 11
  261. Me.Label1.Text = "帐号:"
  262. '
  263. 'TxtPort
  264. '
  265. Me.TxtPort.Location = New System.Drawing.Point(212, 16)
  266. Me.TxtPort.Name = "TxtPort"
  267. Me.TxtPort.Size = New System.Drawing.Size(60, 21)
  268. Me.TxtPort.TabIndex = 10
  269. Me.TxtPort.Text = "8018"
  270. '
  271. 'TxtIp
  272. '
  273. Me.TxtIp.Location = New System.Drawing.Point(48, 16)
  274. Me.TxtIp.Name = "TxtIp"
  275. Me.TxtIp.Size = New System.Drawing.Size(120, 21)
  276. Me.TxtIp.TabIndex = 9
  277. Me.TxtIp.Text = "61.242.89.115"
  278. '
  279. 'Label5
  280. '
  281. Me.Label5.Location = New System.Drawing.Point(176, 21)
  282. Me.Label5.Name = "Label5"
  283. Me.Label5.Size = New System.Drawing.Size(40, 16)
  284. Me.Label5.TabIndex = 8
  285. Me.Label5.Text = "端口:"
  286. '
  287. 'Label19
  288. '
  289. Me.Label19.Location = New System.Drawing.Point(5, 21)
  290. Me.Label19.Name = "Label19"
  291. Me.Label19.Size = New System.Drawing.Size(48, 16)
  292. Me.Label19.TabIndex = 7
  293. Me.Label19.Text = "服务器:"
  294. '
  295. 'GroupBox3
  296. '
  297. Me.GroupBox3.Controls.Add(Me.TxtPhone)
  298. Me.GroupBox3.Controls.Add(Me.Label11)
  299. Me.GroupBox3.Controls.Add(Me.TxtLinkid)
  300. Me.GroupBox3.Controls.Add(Me.Label10)
  301. Me.GroupBox3.Controls.Add(Me.TxtCount)
  302. Me.GroupBox3.Controls.Add(Me.Label9)
  303. Me.GroupBox3.Controls.Add(Me.TxtFee)
  304. Me.GroupBox3.Controls.Add(Me.Label8)
  305. Me.GroupBox3.Controls.Add(Me.Btnreport)
  306. Me.GroupBox3.Controls.Add(Me.BtnRecv)
  307. Me.GroupBox3.Controls.Add(Me.BtnSend)
  308. Me.GroupBox3.Controls.Add(Me.TxtMsg)
  309. Me.GroupBox3.Controls.Add(Me.TxtSPort)
  310. Me.GroupBox3.Controls.Add(Me.Label4)
  311. Me.GroupBox3.Controls.Add(Me.Label3)
  312. Me.GroupBox3.Location = New System.Drawing.Point(8, 112)
  313. Me.GroupBox3.Name = "GroupBox3"
  314. Me.GroupBox3.Size = New System.Drawing.Size(416, 144)
  315. Me.GroupBox3.TabIndex = 16
  316. Me.GroupBox3.TabStop = False
  317. Me.GroupBox3.Text = "信息操作"
  318. '
  319. 'TxtPhone
  320. '
  321. Me.TxtPhone.Location = New System.Drawing.Point(64, 39)
  322. Me.TxtPhone.Name = "TxtPhone"
  323. Me.TxtPhone.Size = New System.Drawing.Size(229, 21)
  324. Me.TxtPhone.TabIndex = 23
  325. Me.TxtPhone.Text = "13534***346"
  326. '
  327. 'Label11
  328. '
  329. Me.Label11.Location = New System.Drawing.Point(9, 43)
  330. Me.Label11.Name = "Label11"
  331. Me.Label11.Size = New System.Drawing.Size(60, 17)
  332. Me.Label11.TabIndex = 22
  333. Me.Label11.Text = "手机号码:"
  334. '
  335. 'TxtLinkid
  336. '
  337. Me.TxtLinkid.Location = New System.Drawing.Point(296, 14)
  338. Me.TxtLinkid.Name = "TxtLinkid"
  339. Me.TxtLinkid.Size = New System.Drawing.Size(111, 21)
  340. Me.TxtLinkid.TabIndex = 21
  341. Me.TxtLinkid.Text = ""
  342. '
  343. 'Label10
  344. '
  345. Me.Label10.Location = New System.Drawing.Point(252, 18)
  346. Me.Label10.Name = "Label10"
  347. Me.Label10.Size = New System.Drawing.Size(48, 17)
  348. Me.Label10.TabIndex = 20
  349. Me.Label10.Text = "匹配码:"
  350. '
  351. 'TxtCount
  352. '
  353. Me.TxtCount.Location = New System.Drawing.Point(352, 39)
  354. Me.TxtCount.Name = "TxtCount"
  355. Me.TxtCount.Size = New System.Drawing.Size(53, 21)
  356. Me.TxtCount.TabIndex = 19
  357. Me.TxtCount.Text = "1"
  358. '
  359. 'Label9
  360. '
  361. Me.Label9.Location = New System.Drawing.Point(296, 43)
  362. Me.Label9.Name = "Label9"
  363. Me.Label9.Size = New System.Drawing.Size(60, 17)
  364. Me.Label9.TabIndex = 18
  365. Me.Label9.Text = "手机个数:"
  366. '
  367. 'TxtFee
  368. '
  369. Me.TxtFee.Location = New System.Drawing.Point(200, 14)
  370. Me.TxtFee.Name = "TxtFee"
  371. Me.TxtFee.Size = New System.Drawing.Size(50, 21)
  372. Me.TxtFee.TabIndex = 17
  373. Me.TxtFee.Text = ""
  374. '
  375. 'Label8
  376. '
  377. Me.Label8.Location = New System.Drawing.Point(144, 18)
  378. Me.Label8.Name = "Label8"
  379. Me.Label8.Size = New System.Drawing.Size(60, 17)
  380. Me.Label8.TabIndex = 16
  381. Me.Label8.Text = "费率代码:"
  382. '
  383. 'Btnreport
  384. '
  385. Me.Btnreport.Enabled = False
  386. Me.Btnreport.Location = New System.Drawing.Point(311, 116)
  387. Me.Btnreport.Name = "Btnreport"
  388. Me.Btnreport.Size = New System.Drawing.Size(95, 23)
  389. Me.Btnreport.TabIndex = 15
  390. Me.Btnreport.Text = "状态报告"
  391. '
  392. 'BtnRecv
  393. '
  394. Me.BtnRecv.Enabled = False
  395. Me.BtnRecv.Location = New System.Drawing.Point(311, 91)
  396. Me.BtnRecv.Name = "BtnRecv"
  397. Me.BtnRecv.Size = New System.Drawing.Size(95, 23)
  398. Me.BtnRecv.TabIndex = 14
  399. Me.BtnRecv.Text = "接收信息"
  400. '
  401. 'BtnSend
  402. '
  403. Me.BtnSend.Location = New System.Drawing.Point(311, 66)
  404. Me.BtnSend.Name = "BtnSend"
  405. Me.BtnSend.Size = New System.Drawing.Size(95, 23)
  406. Me.BtnSend.TabIndex = 13
  407. Me.BtnSend.Text = "单向信息"
  408. '
  409. 'TxtMsg
  410. '
  411. Me.TxtMsg.Location = New System.Drawing.Point(64, 64)
  412. Me.TxtMsg.Multiline = True
  413. Me.TxtMsg.Name = "TxtMsg"
  414. Me.TxtMsg.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
  415. Me.TxtMsg.Size = New System.Drawing.Size(229, 73)
  416. Me.TxtMsg.TabIndex = 12
  417. Me.TxtMsg.Text = "恭喜发财,测试信息"
  418. '
  419. 'TxtSPort
  420. '
  421. Me.TxtSPort.Location = New System.Drawing.Point(64, 14)
  422. Me.TxtSPort.Name = "TxtSPort"
  423. Me.TxtSPort.Size = New System.Drawing.Size(78, 21)
  424. Me.TxtSPort.TabIndex = 11
  425. Me.TxtSPort.Text = ""
  426. '
  427. 'Label4
  428. '
  429. Me.Label4.Location = New System.Drawing.Point(16, 64)
  430. Me.Label4.Name = "Label4"
  431. Me.Label4.Size = New System.Drawing.Size(40, 17)
  432. Me.Label4.TabIndex = 10
  433. Me.Label4.Text = "内容:"
  434. '
  435. 'Label3
  436. '
  437. Me.Label3.Location = New System.Drawing.Point(9, 18)
  438. Me.Label3.Name = "Label3"
  439. Me.Label3.Size = New System.Drawing.Size(60, 17)
  440. Me.Label3.TabIndex = 9
  441. Me.Label3.Text = "端口号码:"
  442. '
  443. 'GroupBox4
  444. '
  445. Me.GroupBox4.Controls.Add(Me.ListInfo)
  446. Me.GroupBox4.Location = New System.Drawing.Point(8, 304)
  447. Me.GroupBox4.Name = "GroupBox4"
  448. Me.GroupBox4.Size = New System.Drawing.Size(416, 112)
  449. Me.GroupBox4.TabIndex = 20
  450. Me.GroupBox4.TabStop = False
  451. Me.GroupBox4.Text = "提示信息"
  452. '
  453. 'ListInfo
  454. '
  455. Me.ListInfo.HorizontalScrollbar = True
  456. Me.ListInfo.ItemHeight = 12
  457. Me.ListInfo.Location = New System.Drawing.Point(8, 16)
  458. Me.ListInfo.Name = "ListInfo"
  459. Me.ListInfo.Size = New System.Drawing.Size(400, 88)
  460. Me.ListInfo.TabIndex = 5
  461. '
  462. 'GroupBox5
  463. '
  464. Me.GroupBox5.Controls.Add(Me.TxtNewPwd)
  465. Me.GroupBox5.Controls.Add(Me.Label7)
  466. Me.GroupBox5.Controls.Add(Me.BtnChangePwd)
  467. Me.GroupBox5.Controls.Add(Me.BtnLeft)
  468. Me.GroupBox5.Controls.Add(Me.BtnUsed)
  469. Me.GroupBox5.Location = New System.Drawing.Point(8, 257)
  470. Me.GroupBox5.Name = "GroupBox5"
  471. Me.GroupBox5.Size = New System.Drawing.Size(416, 43)
  472. Me.GroupBox5.TabIndex = 21
  473. Me.GroupBox5.TabStop = False
  474. Me.GroupBox5.Text = "帐户管理"
  475. '
  476. 'TxtNewPwd
  477. '
  478. Me.TxtNewPwd.Location = New System.Drawing.Point(336, 16)
  479. Me.TxtNewPwd.Name = "TxtNewPwd"
  480. Me.TxtNewPwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
  481. Me.TxtNewPwd.Size = New System.Drawing.Size(60, 21)
  482. Me.TxtNewPwd.TabIndex = 24
  483. Me.TxtNewPwd.Text = ""
  484. '
  485. 'Label7
  486. '
  487. Me.Label7.Location = New System.Drawing.Point(292, 21)
  488. Me.Label7.Name = "Label7"
  489. Me.Label7.Size = New System.Drawing.Size(40, 16)
  490. Me.Label7.TabIndex = 23
  491. Me.Label7.Text = "密码:"
  492. '
  493. 'BtnChangePwd
  494. '
  495. Me.BtnChangePwd.Location = New System.Drawing.Point(200, 16)
  496. Me.BtnChangePwd.Name = "BtnChangePwd"
  497. Me.BtnChangePwd.TabIndex = 22
  498. Me.BtnChangePwd.Text = "修改密码"
  499. '
  500. 'BtnLeft
  501. '
  502. Me.BtnLeft.Location = New System.Drawing.Point(104, 16)
  503. Me.BtnLeft.Name = "BtnLeft"
  504. Me.BtnLeft.TabIndex = 21
  505. Me.BtnLeft.Text = "查询余额"
  506. '
  507. 'BtnUsed
  508. '
  509. Me.BtnUsed.Location = New System.Drawing.Point(8, 16)
  510. Me.BtnUsed.Name = "BtnUsed"
  511. Me.BtnUsed.TabIndex = 20
  512. Me.BtnUsed.Text = "查询使用"
  513. '
  514. 'FrmDemo
  515. '
  516. Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
  517. Me.ClientSize = New System.Drawing.Size(438, 434)
  518. Me.Controls.Add(Me.GroupBox5)
  519. Me.Controls.Add(Me.GroupBox4)
  520. Me.Controls.Add(Me.GroupBox3)
  521. Me.Controls.Add(Me.GroupBox2)
  522. Me.Controls.Add(Me.GroupBox1)
  523. Me.Name = "FrmDemo"
  524. Me.Text = "梦网网关动态库演示程序"
  525. Me.GroupBox1.ResumeLayout(False)
  526. Me.GroupBox2.ResumeLayout(False)
  527. Me.GroupBox3.ResumeLayout(False)
  528. Me.GroupBox4.ResumeLayout(False)
  529. Me.GroupBox5.ResumeLayout(False)
  530. Me.ResumeLayout(False)
  531. End Sub
  532. #End Region
  533. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  534. clientsock = 0
  535. CkClick(0)
  536. End Sub
  537. Function Noconn() As Boolean
  538. Noconn = False
  539. If clientsock <= 0 Then
  540. ListInfo.Items.Add("没有连接到任何服务器!!!")
  541. Noconn = True
  542. End If
  543. End Function
  544. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  545. End Sub
  546. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  547. If (clientsock > 0) Then
  548. MongateDisconnect(clientsock)
  549. ListInfo.Items.Add("断开连接")
  550. clientsock = 0
  551. End If
  552. End Sub
  553. Private Sub Showme(ByVal edtmp As TextBox, ByVal flag As Boolean)
  554. edtmp.Enabled = flag
  555. If flag Then
  556. edtmp.BackColor = SystemColors.Window
  557. Else
  558. edtmp.BackColor = SystemColors.ScrollBar
  559. End If
  560. End Sub
  561. Private Sub CkClick(ByVal seltype As Integer)
  562. If seltype = 0 Then
  563. If CkSingle.Checked Then
  564. CkVas.Checked = 0
  565. Ckkf.Checked = 0
  566. End If
  567. ElseIf seltype = 1 Then
  568. If CkVas.Checked Then
  569. CkSingle.Checked = 0
  570. Ckkf.Checked = 0
  571. End If
  572. Else
  573. If Ckkf.Checked Then
  574. CkVas.Checked = 0
  575. CkSingle.Checked = 0
  576. End If
  577. End If
  578. Showme(TxtSPort, CkVas.Checked)
  579. Showme(TxtFee, CkVas.Checked)
  580. Showme(TxtLinkid, CkVas.Checked)
  581. Showme(TxtCount, (CkVas.Checked Or Ckkf.Checked))
  582. BtnRecv.Enabled = CkVas.Checked Or Ckkf.Checked
  583. Btnreport.Enabled = Ckkf.Checked
  584. If CkVas.Checked Then
  585. BtnSend.Text = "增值信息"
  586. ElseIf Ckkf.Checked Then
  587. BtnSend.Text = "客服信息"
  588. Else
  589. BtnSend.Text = "单向信息"
  590. End If
  591. End Sub
  592. Private Sub CkSingle_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CkSingle.CheckedChanged
  593. CkClick(0)
  594. End Sub
  595. Private Sub CkVas_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CkVas.CheckedChanged
  596. CkClick(1)
  597. End Sub
  598. Private Sub Ckkf_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ckkf.CheckedChanged
  599. CkClick(2)
  600. End Sub
  601. Private Sub BtnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTest.Click
  602. If Noconn() Then Exit Sub
  603. Dim retu_state As Integer
  604. If (clientsock > 0) Then
  605. retu_state = MongateTestConn(clientsock)
  606. If retu_state = 1 Then
  607. ListInfo.Items.Add("测试连接成功")
  608. Else
  609. ListInfo.Items.Add("测试连接失败")
  610. clientsock = 0
  611. BtnConn.Enabled = True
  612. BtnDisConn.Enabled = False
  613. End If
  614. End If
  615. End Sub
  616. Private Sub BtnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSend.Click
  617. If Noconn() Then Exit Sub
  618. Dim retu_state As Long, icount As Integer
  619. Dim retu_msgnumber(40) As Byte
  620. If Noconn() Then Exit Sub
  621. If Trim(TxtCount.Text) = "" Then
  622. icount = 1
  623. Else
  624. icount = CInt(TxtCount.Text)
  625. End If
  626. If CkVas.Checked Then '//增值信息
  627. retu_state = MongateVasSendSms(clientsock, Trim(TxtFee.Text), _
  628. Trim(TxtSPort.Text), "00********", Trim(TxtLinkid.Text), _
  629. Trim(TxtPhone.Text), Trim(TxtMsg.Text), icount)
  630. If (retu_state = 1) Then
  631. ListInfo.Items.Add("发送增值信息成功!")
  632. Else
  633. ListInfo.Items.Add("发送增值信息失败!返回:" + CStr(retu_state))
  634. End If
  635. ElseIf Ckkf.Checked Then '//客服信息
  636. retu_state = MongateCsSendSms(clientsock, Trim(TxtPhone.Text), _
  637. Trim(TxtMsg.Text), icount, retu_msgnumber(0))
  638. If (retu_state = 1) Then
  639. ListInfo.Items.Add("发送客服信息成功!信息编号:" _
  640. + System.Text.Encoding.GetEncoding("gb2312").GetString(retu_msgnumber).ToString())
  641. Else
  642. ListInfo.Items.Add("发送客服信息失败!返回:" + CStr(retu_state))
  643. End If
  644. Else '单向信息
  645. retu_state = MongateSendSms(clientsock, TxtPhone.Text, TxtMsg.Text)
  646. If (retu_state = 1) Then
  647. ListInfo.Items.Add("发送成功")
  648. Else
  649. ListInfo.Items.Add("发送失败")
  650. End If
  651. End If
  652. End Sub
  653. Private Sub BtnRecv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRecv.Click
  654. If Noconn() Then Exit Sub
  655. Dim recv(500, 254) As Byte
  656. Dim buf(255) As Byte
  657. Dim Str As String
  658. Dim num As Integer
  659. Dim i As Integer
  660. Dim k As Integer
  661. If (clientsock > 0) Then
  662. If Ckkf.Checked Then
  663. num = MongateCsGetSms(clientsock, recv(0, 0))
  664. Else
  665. num = MongateVasGetSms(clientsock, recv(0, 0))
  666. End If
  667. If (num > 0) Then
  668. For i = 0 To num - 1
  669. For k = 0 To 254
  670. buf(k) = recv(i, k)
  671. If (buf(k) = 0) Then
  672. Exit For
  673. End If
  674. Next
  675. Str = System.Text.Encoding.GetEncoding("gb2312").GetString(buf).ToString()
  676. ListInfo.Items.Add("接收信息:" & Str)
  677. Next
  678. Else
  679. ListInfo.Items.Add("接收无信息")
  680. End If
  681. End If
  682. End Sub
  683. Private Sub Btnreport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnreport.Click
  684. Dim recv(500, 254) As Byte
  685. Dim buf(255) As Byte
  686. Dim Str As String
  687. Dim num As Integer
  688. Dim i As Integer
  689. Dim k As Integer
  690. If (clientsock > 0) Then
  691. num = MongateCsGetStatusReport(clientsock, recv(0, 0))
  692. If (num > 0) Then
  693. For i = 0 To num - 1
  694. For k = 0 To 254
  695. buf(k) = recv(i, k)
  696. If (buf(k) = 0) Then
  697. Exit For
  698. End If
  699. Next
  700. Str = System.Text.Encoding.GetEncoding("gb2312").GetString(buf).ToString()
  701. ListInfo.Items.Add("状态报告:" & Str)
  702. Next
  703. Else
  704. ListInfo.Items.Add("无状态报告")
  705. End If
  706. End If
  707. End Sub
  708. Private Sub BtnUsed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnUsed.Click
  709. If Noconn() Then Exit Sub
  710. Dim myfee As Integer
  711. Dim myip As String, myport As String
  712. If (clientsock > 0) Then
  713. myfee = MongateQueryUsed(clientsock)
  714. If (myfee >= 0) Then
  715. ListInfo.Items.Add("查询使用成功" & myfee)
  716. Else
  717. ListInfo.Items.Add("查询使用失败" & myfee)
  718. End If
  719. End If
  720. End Sub
  721. Private Sub BtnLeft_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLeft.Click
  722. If Noconn() Then Exit Sub
  723. Dim myfee As Integer
  724. Dim myip As String, myport As String
  725. If (clientsock > 0) Then
  726. myfee = MongateQueryBalance(clientsock)
  727. If (myfee >= 0) Then
  728. ListInfo.Items.Add("查询余额成功" & myfee)
  729. Else
  730. ListInfo.Items.Add("查询余额失败" & myfee)
  731. End If
  732. End If
  733. End Sub
  734. Private Sub BtnChangePwd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnChangePwd.Click
  735. If Noconn() Then Exit Sub
  736. Dim myfee As Integer
  737. Dim myip As String, myport As String
  738. If (clientsock > 0) Then
  739. myfee = MongateChangePwd(clientsock, Trim(TxtAccount.Text), _
  740. Trim(TxtPwd.Text), Trim(TxtNewPwd.Text))
  741. If (myfee >= 0) Then
  742. ListInfo.Items.Add("修改密码成功,请记住新密码")
  743. Else
  744. ListInfo.Items.Add("修改密码失败")
  745. End If
  746. End If
  747. End Sub
  748. Private Sub BtnConn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnConn.Click
  749. If (clientsock <= 0) Then
  750. clientsock = MongateConnect(Trim(TxtIp.Text), CInt(Trim(TxtPort.Text)), _
  751. Trim(TxtAccount.Text), Trim(TxtPwd.Text))
  752. If (clientsock > 0) Then
  753. ListInfo.Items.Add("连接成功,句柄:" & clientsock)
  754. BtnConn.Enabled = False
  755. BtnDisConn.Enabled = True
  756. Else
  757. ListInfo.Items.Add("连接失败,返回:" & clientsock)
  758. End If
  759. End If
  760. End Sub
  761. Private Sub BtnDisConn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDisConn.Click
  762. If (clientsock > 0) Then
  763. MongateDisconnect(clientsock)
  764. ListInfo.Items.Add("断开连接,句柄:" + CStr(clientsock))
  765. clientsock = 0
  766. BtnConn.Enabled = True
  767. BtnDisConn.Enabled = False
  768. End If
  769. End Sub
  770. End Class