Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

516 lines
16 KiB

  1. VERSION 5.00
  2. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
  3. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  4. Begin VB.Form Form1
  5. BorderStyle = 1 'Fixed Single
  6. Caption = "HTTP MSMQ"
  7. ClientHeight = 9375
  8. ClientLeft = 45
  9. ClientTop = 435
  10. ClientWidth = 10965
  11. LinkTopic = "Form1"
  12. MaxButton = 0 'False
  13. MinButton = 0 'False
  14. ScaleHeight = 9375
  15. ScaleWidth = 10965
  16. StartUpPosition = 3 'Windows Default
  17. Begin VB.TextBox txtQueueName
  18. Height = 375
  19. Left = 5640
  20. TabIndex = 12
  21. Top = 1200
  22. Width = 3255
  23. End
  24. Begin VB.TextBox txtMachineName
  25. Height = 375
  26. Left = 1320
  27. TabIndex = 11
  28. Top = 1200
  29. Width = 2415
  30. End
  31. Begin TabDlg.SSTab SSTab1
  32. Height = 7335
  33. Left = 0
  34. TabIndex = 0
  35. Top = 2040
  36. Width = 10965
  37. _ExtentX = 19341
  38. _ExtentY = 12938
  39. _Version = 393216
  40. TabOrientation = 1
  41. Tabs = 2
  42. TabHeight = 520
  43. TabCaption(0) = "Send"
  44. TabPicture(0) = "httpm.frx":0000
  45. Tab(0).ControlEnabled= -1 'True
  46. Tab(0).Control(0)= "Label1"
  47. Tab(0).Control(0).Enabled= 0 'False
  48. Tab(0).Control(1)= "Label3"
  49. Tab(0).Control(1).Enabled= 0 'False
  50. Tab(0).Control(2)= "Label4"
  51. Tab(0).Control(2).Enabled= 0 'False
  52. Tab(0).Control(3)= "Label11"
  53. Tab(0).Control(3).Enabled= 0 'False
  54. Tab(0).Control(4)= "cbSend"
  55. Tab(0).Control(4).Enabled= 0 'False
  56. Tab(0).Control(5)= "txtTitle"
  57. Tab(0).Control(5).Enabled= 0 'False
  58. Tab(0).Control(6)= "txtBody"
  59. Tab(0).Control(6).Enabled= 0 'False
  60. Tab(0).Control(7)= "txtTTRQ"
  61. Tab(0).Control(7).Enabled= 0 'False
  62. Tab(0).ControlCount= 8
  63. TabCaption(1) = "Browse"
  64. TabPicture(1) = "httpm.frx":001C
  65. Tab(1).ControlEnabled= 0 'False
  66. Tab(1).Control(0)= "Label7"
  67. Tab(1).Control(0).Enabled= 0 'False
  68. Tab(1).Control(1)= "Label8"
  69. Tab(1).Control(1).Enabled= 0 'False
  70. Tab(1).Control(2)= "Label9"
  71. Tab(1).Control(2).Enabled= 0 'False
  72. Tab(1).Control(3)= "Label10"
  73. Tab(1).Control(3).Enabled= 0 'False
  74. Tab(1).Control(4)= "lbLookupId"
  75. Tab(1).Control(4).Enabled= 0 'False
  76. Tab(1).Control(5)= "Label12"
  77. Tab(1).Control(5).Enabled= 0 'False
  78. Tab(1).Control(6)= "WebBrowser1"
  79. Tab(1).Control(6).Enabled= 0 'False
  80. Tab(1).Control(7)= "cbStartPeek"
  81. Tab(1).Control(7).Enabled= 0 'False
  82. Tab(1).Control(8)= "cbPrev"
  83. Tab(1).Control(8).Enabled= 0 'False
  84. Tab(1).Control(9)= "cbNext"
  85. Tab(1).Control(9).Enabled= 0 'False
  86. Tab(1).Control(10)= "tbRcvLabel"
  87. Tab(1).Control(10).Enabled= 0 'False
  88. Tab(1).Control(11)= "tbRcvBody"
  89. Tab(1).Control(11).Enabled= 0 'False
  90. Tab(1).ControlCount= 12
  91. Begin VB.TextBox txtTTRQ
  92. Height = 375
  93. Left = 960
  94. TabIndex = 25
  95. Text = "30"
  96. Top = 2760
  97. Width = 495
  98. End
  99. Begin VB.TextBox tbRcvBody
  100. Enabled = 0 'False
  101. Height = 375
  102. Left = -74880
  103. TabIndex = 22
  104. Top = 3960
  105. Width = 3255
  106. End
  107. Begin VB.TextBox tbRcvLabel
  108. Enabled = 0 'False
  109. Height = 375
  110. Left = -74880
  111. TabIndex = 21
  112. Top = 2520
  113. Width = 3255
  114. End
  115. Begin VB.CommandButton cbNext
  116. Caption = "Next"
  117. Height = 375
  118. Left = -72960
  119. TabIndex = 17
  120. Top = 6360
  121. Width = 1215
  122. End
  123. Begin VB.CommandButton cbPrev
  124. Caption = "Previous"
  125. Height = 375
  126. Left = -74760
  127. TabIndex = 16
  128. Top = 6360
  129. Width = 1095
  130. End
  131. Begin VB.CommandButton cbStartPeek
  132. Caption = "Begin!"
  133. Height = 495
  134. Left = -74760
  135. TabIndex = 15
  136. Top = 1080
  137. Width = 2655
  138. End
  139. Begin SHDocVwCtl.WebBrowser WebBrowser1
  140. Height = 4815
  141. Left = -71520
  142. TabIndex = 13
  143. Top = 1560
  144. Width = 7335
  145. ExtentX = 12938
  146. ExtentY = 8493
  147. ViewMode = 0
  148. Offline = 0
  149. Silent = 0
  150. RegisterAsBrowser= 0
  151. RegisterAsDropTarget= 1
  152. AutoArrange = 0 'False
  153. NoClientEdge = 0 'False
  154. AlignLeft = 0 'False
  155. NoWebView = 0 'False
  156. HideFileNames = 0 'False
  157. SingleClick = 0 'False
  158. SingleSelection = 0 'False
  159. NoFolders = 0 'False
  160. Transparent = 0 'False
  161. ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  162. Location = "http:///"
  163. End
  164. Begin VB.TextBox txtBody
  165. Height = 375
  166. Left = 4560
  167. TabIndex = 4
  168. Text = "Message Body"
  169. Top = 1680
  170. Width = 3495
  171. End
  172. Begin VB.TextBox txtTitle
  173. Height = 375
  174. Left = 240
  175. TabIndex = 3
  176. Text = "This is the message label"
  177. Top = 1680
  178. Width = 3255
  179. End
  180. Begin VB.CommandButton cbSend
  181. Caption = "Send!"
  182. BeginProperty Font
  183. Name = "Arial"
  184. Size = 14.25
  185. Charset = 0
  186. Weight = 700
  187. Underline = 0 'False
  188. Italic = 0 'False
  189. Strikethrough = 0 'False
  190. EndProperty
  191. Height = 735
  192. Left = 3000
  193. TabIndex = 2
  194. Top = 4920
  195. Width = 2655
  196. End
  197. Begin VB.Label Label12
  198. Caption = "Msg LookupID:"
  199. Height = 255
  200. Left = -74880
  201. TabIndex = 26
  202. Top = 5040
  203. Width = 1095
  204. End
  205. Begin VB.Label Label11
  206. Caption = "Time To Reach Queue (sec):"
  207. BeginProperty Font
  208. Name = "Arial Narrow"
  209. Size = 12
  210. Charset = 0
  211. Weight = 700
  212. Underline = -1 'True
  213. Italic = -1 'True
  214. Strikethrough = 0 'False
  215. EndProperty
  216. Height = 375
  217. Left = 240
  218. TabIndex = 24
  219. Top = 2280
  220. Width = 2775
  221. End
  222. Begin VB.Label lbLookupId
  223. Caption = "Label11"
  224. Height = 255
  225. Left = -73680
  226. TabIndex = 23
  227. Top = 5040
  228. Width = 1695
  229. End
  230. Begin VB.Label Label10
  231. Caption = "SOAP Envelope"
  232. BeginProperty Font
  233. Name = "Arial Narrow"
  234. Size = 12
  235. Charset = 0
  236. Weight = 700
  237. Underline = -1 'True
  238. Italic = -1 'True
  239. Strikethrough = 0 'False
  240. EndProperty
  241. Height = 375
  242. Left = -70920
  243. TabIndex = 20
  244. Top = 1080
  245. Width = 2175
  246. End
  247. Begin VB.Label Label9
  248. Caption = "Message Body"
  249. BeginProperty Font
  250. Name = "Arial Narrow"
  251. Size = 12
  252. Charset = 0
  253. Weight = 700
  254. Underline = -1 'True
  255. Italic = -1 'True
  256. Strikethrough = 0 'False
  257. EndProperty
  258. Height = 495
  259. Left = -74880
  260. TabIndex = 19
  261. Top = 3480
  262. Width = 2055
  263. End
  264. Begin VB.Label Label8
  265. Caption = "Message Label"
  266. BeginProperty Font
  267. Name = "Arial Narrow"
  268. Size = 12
  269. Charset = 0
  270. Weight = 700
  271. Underline = -1 'True
  272. Italic = -1 'True
  273. Strikethrough = 0 'False
  274. EndProperty
  275. Height = 375
  276. Left = -74880
  277. TabIndex = 18
  278. Top = 2040
  279. Width = 1815
  280. End
  281. Begin VB.Label Label7
  282. Caption = "Browse"
  283. BeginProperty Font
  284. Name = "Arial"
  285. Size = 36
  286. Charset = 0
  287. Weight = 700
  288. Underline = 0 'False
  289. Italic = 0 'False
  290. Strikethrough = 0 'False
  291. EndProperty
  292. Height = 855
  293. Left = -71520
  294. TabIndex = 14
  295. Top = 120
  296. Width = 3495
  297. End
  298. Begin VB.Label Label4
  299. Caption = "Message Body:"
  300. BeginProperty Font
  301. Name = "Arial Narrow"
  302. Size = 12
  303. Charset = 0
  304. Weight = 700
  305. Underline = -1 'True
  306. Italic = -1 'True
  307. Strikethrough = 0 'False
  308. EndProperty
  309. Height = 375
  310. Left = 4560
  311. TabIndex = 6
  312. Top = 1200
  313. Width = 3495
  314. End
  315. Begin VB.Label Label3
  316. Caption = "Message Label"
  317. BeginProperty Font
  318. Name = "Arial Narrow"
  319. Size = 12
  320. Charset = 0
  321. Weight = 700
  322. Underline = -1 'True
  323. Italic = -1 'True
  324. Strikethrough = 0 'False
  325. EndProperty
  326. Height = 495
  327. Left = 240
  328. TabIndex = 5
  329. Top = 1200
  330. Width = 2295
  331. End
  332. Begin VB.Label Label1
  333. Caption = "Sending"
  334. BeginProperty Font
  335. Name = "Arial"
  336. Size = 36
  337. Charset = 0
  338. Weight = 700
  339. Underline = 0 'False
  340. Italic = 0 'False
  341. Strikethrough = 0 'False
  342. EndProperty
  343. Height = 975
  344. Left = 3840
  345. TabIndex = 1
  346. Top = 120
  347. Width = 3015
  348. End
  349. End
  350. Begin VB.Label lbFormatName
  351. Caption = "....place holder for format name display......"
  352. Height = 375
  353. Left = 120
  354. TabIndex = 10
  355. Top = 1680
  356. Width = 9015
  357. End
  358. Begin VB.Label Label5
  359. Caption = "Queue Name:"
  360. Height = 375
  361. Left = 4080
  362. TabIndex = 9
  363. Top = 1200
  364. Width = 1215
  365. End
  366. Begin VB.Label Label2
  367. Caption = "Machine Name:"
  368. Height = 375
  369. Left = 120
  370. TabIndex = 8
  371. Top = 1200
  372. Width = 1215
  373. End
  374. Begin VB.Label Label6
  375. Caption = "HTTP Messages"
  376. BeginProperty Font
  377. Name = "Arial"
  378. Size = 36
  379. Charset = 0
  380. Weight = 700
  381. Underline = 0 'False
  382. Italic = 0 'False
  383. Strikethrough = 0 'False
  384. EndProperty
  385. Height = 975
  386. Left = 3000
  387. TabIndex = 7
  388. Top = 0
  389. Width = 5895
  390. End
  391. End
  392. Attribute VB_Name = "Form1"
  393. Attribute VB_GlobalNameSpace = False
  394. Attribute VB_Creatable = False
  395. Attribute VB_PredeclaredId = True
  396. Attribute VB_Exposed = False
  397. Option Explicit
  398. Dim QueueName As String
  399. Dim FormatName As String
  400. Dim rcvQInfo As New MSMQQueueInfo
  401. Dim rcvQ As MSMQQueue
  402. Dim lastLookupId As Variant
  403. Dim lastmsgRec As MSMQMessage
  404. Private Sub SetAndDisplayFormatName()
  405. FormatName = "DIRECT=http://" + txtMachineName.Text + "/MSMQ/" + txtQueueName.Text
  406. lbFormatName.Caption = "Format name for the queue is: " + FormatName
  407. End Sub
  408. Private Sub cbNext_Click()
  409. Set lastmsgRec = rcvQ.PeekNextByLookupId(lastLookupId)
  410. Call DisplayLastRecvMessage
  411. End Sub
  412. Private Sub cbPrev_Click()
  413. Set lastmsgRec = rcvQ.PeekPreviousByLookupId(lastLookupId)
  414. Call DisplayLastRecvMessage
  415. End Sub
  416. Private Sub cbSend_Click()
  417. '*************************************************************
  418. ' Declare the required objects.
  419. '*************************************************************
  420. Dim qinfo As New MSMQQueueInfo
  421. Dim q As MSMQQueue
  422. Dim m As New MSMQMessage
  423. '*************************************************************
  424. ' Create a destination queue and open it with SEND access.
  425. '*************************************************************
  426. qinfo.FormatName = FormatName
  427. Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
  428. '*************************************************************
  429. ' Send message with a String body type.
  430. '*************************************************************
  431. m.Label = txtTitle.Text
  432. m.Body = txtBody.Text
  433. m.MaxTimeToReachQueue = txtTTRQ.Text
  434. m.Send q
  435. '*************************************************************
  436. ' Close queue.
  437. '*************************************************************
  438. q.Close
  439. End Sub
  440. Private Sub DisplayLastRecvMessage()
  441. Dim soapenv As String
  442. tbRcvLabel.Text = lastmsgRec.Label
  443. tbRcvBody.Text = lastmsgRec.Body
  444. lastLookupId = lastmsgRec.LookupId
  445. lbLookupId.Caption = lastLookupId
  446. '
  447. 'Display the SOAP envlope
  448. 'using Internet Explorer rendering XML files
  449. '
  450. soapenv = lastmsgRec.SoapEnvelope
  451. 'Write the SOAP envelope in a temporary file
  452. Open "c:\tt.xml" For Output As #1
  453. Print #1, soapenv
  454. Close
  455. 'and display the file in the browser window
  456. WebBrowser1.Navigate "c:\tt.xml"
  457. End Sub
  458. Private Sub cbStartPeek_Click()
  459. '*************************************************************
  460. ' Declare the required objects.
  461. '*************************************************************
  462. rcvQInfo.FormatName = FormatName
  463. '***********************************************************
  464. ' Open destination queue for retrieving messages.
  465. '***********************************************************
  466. Set rcvQ = rcvQInfo.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)
  467. '************************************************************
  468. ' Retrieve messages from the queues.
  469. '************************************************************
  470. 'Set msgRec = q.Peek(ReceiveTimeout:=1000)
  471. Set lastmsgRec = rcvQ.PeekFirstByLookupId
  472. Call DisplayLastRecvMessage
  473. End Sub
  474. Private Sub Form_Load()
  475. lbFormatName.Caption = ""
  476. End Sub
  477. Private Sub txtMachineName_Change()
  478. Call SetAndDisplayFormatName
  479. End Sub
  480. Private Sub txtQueueName_Change()
  481. Call SetAndDisplayFormatName
  482. End Sub