Leaked source code of windows server 2003
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.

658 lines
18 KiB

  1. VERSION 5.00
  2. Begin VB.Form Form1
  3. Caption = "Form1"
  4. ClientHeight = 3120
  5. ClientLeft = 60
  6. ClientTop = 345
  7. ClientWidth = 6195
  8. LinkTopic = "Form1"
  9. ScaleHeight = 3120
  10. ScaleWidth = 6195
  11. StartUpPosition = 3 'Windows Default
  12. Begin VB.CommandButton cmdIRM
  13. Caption = "Inbound Routing Methods"
  14. BeginProperty Font
  15. Name = "Palatino Linotype"
  16. Size = 11.25
  17. Charset = 0
  18. Weight = 400
  19. Underline = 0 'False
  20. Italic = 0 'False
  21. Strikethrough = 0 'False
  22. EndProperty
  23. Height = 495
  24. Left = 1440
  25. TabIndex = 10
  26. Top = 960
  27. Width = 4575
  28. End
  29. Begin VB.CommandButton cmdDevices
  30. Caption = "Devices"
  31. BeginProperty Font
  32. Name = "Palatino Linotype"
  33. Size = 11.25
  34. Charset = 0
  35. Weight = 400
  36. Underline = 0 'False
  37. Italic = 0 'False
  38. Strikethrough = 0 'False
  39. EndProperty
  40. Height = 495
  41. Left = 4440
  42. TabIndex = 9
  43. Top = 1680
  44. Width = 1575
  45. End
  46. Begin VB.CommandButton cmdProviders
  47. Caption = "Device Providers"
  48. BeginProperty Font
  49. Name = "Palatino Linotype"
  50. Size = 11.25
  51. Charset = 0
  52. Weight = 400
  53. Underline = 0 'False
  54. Italic = 0 'False
  55. Strikethrough = 0 'False
  56. EndProperty
  57. Height = 495
  58. Left = 2640
  59. TabIndex = 8
  60. Top = 2400
  61. Width = 1935
  62. End
  63. Begin VB.CommandButton cmdSecurity
  64. Caption = "Security"
  65. BeginProperty Font
  66. Name = "Palatino Linotype"
  67. Size = 11.25
  68. Charset = 0
  69. Weight = 400
  70. Underline = 0 'False
  71. Italic = 0 'False
  72. Strikethrough = 0 'False
  73. EndProperty
  74. Height = 495
  75. Left = 4800
  76. TabIndex = 7
  77. Top = 2400
  78. Width = 1215
  79. End
  80. Begin VB.CommandButton cmdActivity
  81. Caption = "Activity"
  82. BeginProperty Font
  83. Name = "Palatino Linotype"
  84. Size = 11.25
  85. Charset = 0
  86. Weight = 400
  87. Underline = 0 'False
  88. Italic = 0 'False
  89. Strikethrough = 0 'False
  90. EndProperty
  91. Height = 495
  92. Left = 3000
  93. TabIndex = 6
  94. Top = 1680
  95. Width = 1215
  96. End
  97. Begin VB.CommandButton cmdLoggingOptions
  98. Caption = "Logging Options"
  99. BeginProperty Font
  100. Name = "Palatino Linotype"
  101. Size = 11.25
  102. Charset = 0
  103. Weight = 400
  104. Underline = 0 'False
  105. Italic = 0 'False
  106. Strikethrough = 0 'False
  107. EndProperty
  108. Height = 495
  109. Left = 120
  110. TabIndex = 5
  111. Top = 2400
  112. Width = 2295
  113. End
  114. Begin VB.CommandButton cmdMail
  115. Caption = "Mail"
  116. BeginProperty Font
  117. Name = "Palatino Linotype"
  118. Size = 11.25
  119. Charset = 0
  120. Weight = 400
  121. Underline = 0 'False
  122. Italic = 0 'False
  123. Strikethrough = 0 'False
  124. EndProperty
  125. Height = 495
  126. Left = 1560
  127. TabIndex = 4
  128. Top = 1680
  129. Width = 1215
  130. End
  131. Begin VB.CommandButton cmdQueue
  132. Caption = "Queue"
  133. BeginProperty Font
  134. Name = "Palatino Linotype"
  135. Size = 11.25
  136. Charset = 0
  137. Weight = 400
  138. Underline = 0 'False
  139. Italic = 0 'False
  140. Strikethrough = 0 'False
  141. EndProperty
  142. Height = 495
  143. Left = 120
  144. TabIndex = 3
  145. Top = 1680
  146. Width = 1215
  147. End
  148. Begin VB.CommandButton cmdFolders
  149. Caption = "Folders"
  150. BeginProperty Font
  151. Name = "Palatino Linotype"
  152. Size = 11.25
  153. Charset = 0
  154. Weight = 400
  155. Underline = 0 'False
  156. Italic = 0 'False
  157. Strikethrough = 0 'False
  158. EndProperty
  159. Height = 495
  160. Left = 120
  161. TabIndex = 2
  162. Top = 960
  163. Width = 1215
  164. End
  165. Begin VB.CommandButton cmdSentItems
  166. Caption = "Sent Items"
  167. Enabled = 0 'False
  168. Height = 495
  169. Left = 1560
  170. TabIndex = 1
  171. Top = 120
  172. Width = 1215
  173. End
  174. Begin VB.CommandButton cmdInbox
  175. Caption = "Inbox"
  176. Enabled = 0 'False
  177. Height = 495
  178. Left = 120
  179. TabIndex = 0
  180. Top = 120
  181. Width = 1215
  182. End
  183. End
  184. Attribute VB_Name = "Form1"
  185. Attribute VB_GlobalNameSpace = False
  186. Attribute VB_Creatable = False
  187. Attribute VB_PredeclaredId = True
  188. Attribute VB_Exposed = False
  189. Dim ServerObject As New FAXCOMEXLib.FaxServer
  190. Dim Folders As FaxFolders
  191. Dim bFoldersInitialized As Boolean
  192. Option Explicit
  193. Private Sub InitFolders()
  194. If Not bFoldersInitialized Then
  195. Set Folders = ServerObject.Folders
  196. bFoldersInitialized = True
  197. End If
  198. End Sub
  199. Private Sub cmdActivity_Click()
  200. Dim Act As FaxActivity
  201. Set Act = ServerObject.Activity
  202. MsgBox Act.DelegatedOutgoingMessages, , "Delegated"
  203. MsgBox Act.IncomingMessages, , "Incoming"
  204. MsgBox Act.OutgoingMessages, , "Outgoing"
  205. MsgBox Act.QueuedMessages, , "Queued"
  206. MsgBox Act.RoutingMessages, , "Routing"
  207. Act.Refresh
  208. MsgBox "After Refresh"
  209. MsgBox Act.DelegatedOutgoingMessages, , "Delegated"
  210. MsgBox Act.IncomingMessages, , "Incoming"
  211. MsgBox Act.OutgoingMessages, , "Outgoing"
  212. MsgBox Act.QueuedMessages, , "Queued"
  213. MsgBox Act.RoutingMessages, , "Routing"
  214. End Sub
  215. Private Sub cmdDevices_Click()
  216. Dim DevicesCollection As FaxDevices
  217. Set DevicesCollection = ServerObject.GetDevices
  218. MsgBox DevicesCollection.Count, , "Count"
  219. MsgBox DevicesCollection.Item(1).Id, , "Item(1).Id"
  220. MsgBox DevicesCollection.ItemById(65538).Id, , "ItemById(65538).Id"
  221. Dim Device As FaxDevice
  222. Set Device = DevicesCollection.Item(1)
  223. ' Dim Methods As Variant
  224. ' Methods = Device.UsedRoutingMethods
  225. ' MsgBox UBound(Methods), , "U BOUND"
  226. ' MsgBox LBound(Methods), , "L BOUND"
  227. ' MsgBox IsEmpty(Methods), , "IS EMPTY"
  228. ' If Not IsEmpty(Methods) Then
  229. ' MsgBox Methods(0), , "First GUID"
  230. ' End If
  231. MsgBox Device.AutoAnswer, , "Auto Answer"
  232. ' MsgBox Device.CSID, , "CSID"
  233. ' MsgBox Device.Description, , "Description"
  234. ' MsgBox Device.DeviceName, , "Device Name"
  235. ' MsgBox Device.Id, , "Id"
  236. ' MsgBox Device.PoweredOff, , "Powered Off"
  237. ' MsgBox Device.ProviderGUID, , "Provider GUID"
  238. ' MsgBox Device.ProviderName, , "Provider Name"
  239. ' MsgBox Device.Receive, , "Receive"
  240. ' Device.Refresh
  241. ' MsgBox Device.RingsBeforeAnswer, , "Rings After Refresh"
  242. ' MsgBox Device.Send, , "Send"
  243. ' MsgBox Device.TSID, , "TSID"
  244. Device.AutoAnswer = Not Device.AutoAnswer
  245. Device.Save
  246. MsgBox Device.AutoAnswer, , "AutoAnswer After Save"
  247. Dim vProperty(5) As Byte
  248. vProperty(0) = 1
  249. vProperty(1) = 2
  250. vProperty(2) = 3
  251. vProperty(3) = 4
  252. vProperty(4) = 5
  253. Dim vArg As Variant
  254. vArg = vProperty
  255. Device.SetExtensionProperty "{C3C9B43B-A7F8-44ae-90B3-D6768CD0DA59}", vArg
  256. Dim vRes As Variant
  257. vRes = Device.GetExtensionProperty("{C3C9B43B-A7F8-44ae-90B3-D6768CD0DA59}")
  258. MsgBox UBound(vRes), , "U BOUND"
  259. MsgBox LBound(vRes), , "L BOUND"
  260. MsgBox IsEmpty(vRes), , "IS EMPTY"
  261. If Not IsEmpty(vRes) Then
  262. MsgBox vRes(0), , "First Value"
  263. MsgBox vRes(1), , "Second Value"
  264. MsgBox vRes(3), , "Fourth Value"
  265. MsgBox vRes(4), , "Fifth Value"
  266. End If
  267. End Sub
  268. Private Sub cmdFolders_Click()
  269. Dim ff As FaxFolders
  270. Set ff = ServerObject.Folders
  271. MsgBox ff.IncomingArchive.AgeLimit, , "Incoming Archive Age Limit"
  272. Set ServerObject = Nothing
  273. MsgBox ff.OutgoingArchive.AgeLimit, , "Outgoing Archive Age Limit"
  274. End Sub
  275. Private Sub cmdInbox_Click()
  276. InitFolders
  277. Dim Inbox As FaxIncomingArchive
  278. Set Inbox = Folders.IncomingArchive
  279. ' MsgBox Inbox.SizeHigh
  280. ' MsgBox Inbox.SizeLow
  281. Dim Iter As FaxIncomingMessageIterator
  282. Set Iter = Inbox.GetMessages
  283. MsgBox Iter.EOF
  284. Iter.MoveFirst
  285. ' MsgBox Iter.EOF
  286. Dim Msg As FaxIncomingMessage
  287. Set Msg = Iter.Message
  288. ' MsgBox Msg.Id
  289. Dim Msg2 As FaxIncomingMessage
  290. Set Msg2 = Inbox.GetMessage(Msg.Id)
  291. MsgBox Msg2.Id
  292. Dim Count As Integer
  293. Count = 0
  294. Iter.MoveFirst
  295. Set Msg = Iter.Message
  296. MsgBox Msg.Id
  297. While Not Iter.EOF
  298. Count = Count + 1
  299. Iter.MoveNext
  300. If Count > 1879 Then
  301. MsgBox Msg.Id
  302. Exit Sub
  303. End If
  304. Wend
  305. MsgBox Count, , "Total Num Of Messages"
  306. ' Dim InBoundMsg As FaxInboundMessage
  307. ' Set InBoundMsg = Inbox.GetMessage("1102719151")
  308. ' 0000000041ba28af
  309. ' MsgBox InBoundMsg.Id
  310. ' MsgBox InBoundMsg.Pages
  311. ' MsgBox InBoundMsg.TSID
  312. ' InBoundMsg.Delete
  313. ' Dim InBoundMsg2 As FaxInboundMessage
  314. ' Set InBoundMsg2 = Inbox.GetMessage("00000000926628ae")
  315. ' MsgBox Inbox.AgeLimit
  316. ' MsgBox Inbox.UseArchive
  317. ' Inbox.UseArchive = Not Inbox.UseArchive
  318. ' MsgBox Inbox.UseArchive
  319. End Sub
  320. Private Sub cmdIRM_Click()
  321. Dim IR As FaxInboundRouting
  322. Set IR = ServerObject.InboundRouting
  323. Dim Coll As FaxInboundRoutingMethods
  324. Set Coll = IR.GetMethods
  325. MsgBox Coll.Count, , "Count"
  326. MsgBox Coll.Item(1).Guid
  327. MsgBox Coll.Item(2).Priority
  328. MsgBox Coll.Item(3).Priority, , "Before Change"
  329. Coll.Item(3).Priority = Coll.Item(3).Priority + 3
  330. MsgBox Coll.Item(3).Priority, , "After Change"
  331. Coll.Item(3).Save
  332. MsgBox Coll.Item(3).Priority, , "After Save"
  333. Coll.Item(3).Refresh
  334. MsgBox Coll.Item(3).Priority, , "After Refresh"
  335. End Sub
  336. Private Sub cmdLoggingOptions_Click()
  337. Dim LogOpt As FaxLoggingOptions
  338. Set LogOpt = ServerObject.LoggingOptions
  339. Set ServerObject = Nothing
  340. Dim xx As FaxActivityLogging
  341. Set xx = LogOpt.ActivityLogging
  342. MsgBox xx.DatabasePath, , "Database Path"
  343. MsgBox xx.LogIncoming, , "LogIncoming"
  344. MsgBox xx.LogOutgoing, , "LogOutgoing"
  345. xx.LogIncoming = Not xx.LogOutgoing
  346. xx.Save
  347. xx.Refresh
  348. MsgBox xx.LogIncoming, , "LogIncoming"
  349. MsgBox xx.LogOutgoing, , "LogOutgoing"
  350. Dim yy As FaxEventLogging
  351. Set yy = LogOpt.EventLogging
  352. MsgBox yy.GeneralEventsLevel, , "General Events Level"
  353. MsgBox yy.InboundEventsLevel, , "Inbound Events Level"
  354. yy.InboundEventsLevel = fllMAX
  355. yy.Save
  356. yy.Refresh
  357. MsgBox yy.InboundEventsLevel, , "Inbound Events Level"
  358. End Sub
  359. Private Sub cmdMail_Click()
  360. Dim Mail As FaxMailOptions
  361. Set Mail = ServerObject.MailOptions
  362. MsgBox Mail.MAPIProfile, , "MAPI Profile"
  363. MsgBox Mail.SMTPDomain, , "Domain"
  364. MsgBox Mail.SMTPPassword, , "Password"
  365. MsgBox Mail.SMTPPort, , "Port"
  366. MsgBox Mail.SMTPSender, , "Sender"
  367. MsgBox Mail.SMTPServer, , "Server"
  368. MsgBox Mail.SMTPUser, , "User"
  369. MsgBox Mail.Type, , "Type"
  370. Refresh
  371. Mail.Type = fmroNONE
  372. Mail.SMTPDomain = "kuku"
  373. Mail.Save
  374. End Sub
  375. Private Sub cmdProviders_Click()
  376. Dim DPS As FaxDeviceProviders
  377. Set DPS = ServerObject.GetDeviceProviders
  378. MsgBox DPS.Count
  379. If DPS.Count > 0 Then
  380. ' MsgBox DPS.Item(1).Capabilities, , "Capabilities"
  381. ' MsgBox DPS.Item(1).Debug, , "Debug"
  382. ' MsgBox DPS.Item(1).FriendlyName, , "FriendlyName"
  383. ' MsgBox DPS.Item(1).Guid, , "Guid"
  384. ' MsgBox DPS.Item(1).ImageName, , "ImageName"
  385. ' MsgBox DPS.Item(1).InitErrorCode, , "InitErrorCode"
  386. ' MsgBox DPS.Item(1).MajorBuild, , "MajorBuild"
  387. ' MsgBox DPS.Item(1).MajorVersion, , "MajorVersion"
  388. ' MsgBox DPS.Item(1).MinorBuild, , "MinorBuild"
  389. ' MsgBox DPS.Item(1).MinorVersion, , "MinorVersion"
  390. ' MsgBox DPS.Item(1).Status, , "Status"
  391. ' MsgBox DPS.Item(1).TapiProviderName, , "TapiProviderName"
  392. Dim IDS As Variant
  393. IDS = DPS.Item(1).DeviceIds
  394. MsgBox UBound(IDS)
  395. MsgBox LBound(IDS)
  396. MsgBox IsEmpty(IDS)
  397. MsgBox IDS(0), , "Device ID"
  398. MsgBox "Variant ( SafeArray ) is freed"
  399. End If
  400. Set DPS = Nothing
  401. MsgBox "collection is freed"
  402. End Sub
  403. Private Sub cmdQueue_Click()
  404. InitFolders
  405. Dim Q As FaxOutgoingQueue
  406. Set Q = Folders.OutgoingQueue
  407. ' MsgBox Q.AgeLimit, , "Age Limit"
  408. ' MsgBox Q.AllowPersonalCoverPages, , "Allow Personal Cover Pages"
  409. ' MsgBox Q.Blocked, , "Blocked"
  410. ' MsgBox Q.Branding, , "Branding"
  411. ' MsgBox Q.DiscountRateEnd, , "Discount Rate End"
  412. ' MsgBox Q.DiscountRateStart, , "Discount Rate Start"
  413. ' MsgBox Q.Paused, , "Paused"
  414. ' Q.Refresh
  415. ' MsgBox "After Refresh"
  416. ' MsgBox Q.Retries, , "Retries"
  417. ' MsgBox Q.RetryDelay, , "Retry Delay"
  418. ' MsgBox Q.UseDeviceTSID, , "Use Device TSID"
  419. Set ServerObject = Nothing
  420. Set Folders = Nothing
  421. Dim QJobs As FaxOutgoingJobs
  422. Set QJobs = Q.GetJobs
  423. MsgBox QJobs.Count, , "Count"
  424. ' Set Q = Nothing
  425. Dim Jb As FaxOutgoingJob
  426. For Each Jb In QJobs
  427. MsgBox Jb.Id, , "Id of Loop"
  428. Jb.Resume
  429. Next
  430. Set Jb = QJobs.Item(1)
  431. MsgBox Jb.Id, , "Job Id of Item #1 in the Outgoing Job Collection"
  432. Dim x As String
  433. x = Jb.Id
  434. Dim Jbb As FaxOutgoingJob
  435. Set Jbb = Q.GetJob(x)
  436. MsgBox Jbb.Subject, , "Job by Id : Subject"
  437. Dim QI As FaxIncomingQueue
  438. Set QI = Folders.IncomingQueue
  439. Dim InJobs As FaxIncomingJobs
  440. Set InJobs = QI.GetJobs
  441. MsgBox InJobs.Count, , "Count"
  442. ' Print_Job_Subject Jbb
  443. End Sub
  444. Private Sub Print_Job_Subject(JobToPrint As FaxOutgoingJob)
  445. MsgBox JobToPrint.Subject, , "Print Job Subject Function"
  446. End Sub
  447. Private Sub cmdSecurity_Click()
  448. Dim SS As FaxSecurity
  449. Set SS = ServerObject.Security
  450. Set ServerObject = Nothing
  451. MsgBox SS.GrantedRights, , "Granted Rights"
  452. MsgBox SS.Descriptor, , "Descriptor"
  453. ' SS.Save
  454. SS.Refresh
  455. Dim ARV As Variant
  456. ARV = SS.Descriptor
  457. ARV(1) = 23
  458. SS.Descriptor = ARV
  459. MsgBox SS.Descriptor, , "After Set My Value"
  460. End Sub
  461. Private Sub cmdSentItems_Click()
  462. InitFolders
  463. Dim SentItems As FaxOutgoingArchive
  464. Set SentItems = Folders.OutgoingArchive
  465. ' MsgBox SentItems.ArchiveFolder, , "Age"
  466. ' MsgBox SentItems.AgeLimit, , "Archive Folder"
  467. Dim Msg As FaxOutgoingMessage
  468. Set Msg = SentItems.GetMessage("0x00000200873628ae")
  469. MsgBox Msg.Id, , "First Msg ID"
  470. ' Dim sId As String
  471. ' sId = "0x00000200873628ae" 'Msg.Id
  472. Dim MsgA As FaxOutgoingMessage
  473. Set MsgA = SentItems.GetMessage("0x00000200839628ae")
  474. MsgBox MsgA.Id, , "Second Msg ID"
  475. Dim Iter As FaxOutgoingMessageIterator
  476. Set Iter = SentItems.GetMessages
  477. MsgBox Iter.EOF, , "EOF"
  478. MsgBox Iter.PrefetchSize, , "Prefetch Size"
  479. Iter.MoveFirst
  480. MsgBox Iter.EOF, , "EOF after MoveFirst"
  481. Dim Count As Integer
  482. Count = 0
  483. While Not Iter.EOF
  484. Set Msg = Iter.Message
  485. MsgBox Msg.Id
  486. Count = Count + 1
  487. Iter.MoveNext
  488. Wend
  489. MsgBox Count, , "Total Num Of Messages"
  490. ' MsgBox SentItems.AgeLimit
  491. ' MsgBox SentItems.UseArchive
  492. ' SentItems.UseArchive = Not SentItems.UseArchive
  493. ' MsgBox SentItems.UseArchive
  494. ' Dim OutBoundMsg As FaxOutboundMessage
  495. ' Set OutBoundMsg = SentItems.GetMessage("2201291729070")
  496. ' 00000200873628ae
  497. ' MsgBox OutBoundMsg.Id
  498. ' MsgBox OutBoundMsg.Pages
  499. ' MsgBox OutBoundMsg.Subject
  500. ' Dim Recipient As FaxPersonalProfile
  501. ' Set Recipient = OutBoundMsg.Recipient
  502. ' MsgBox Recipient.Name
  503. End Sub
  504. Private Sub Form_Load()
  505. ServerObject.Connect ""
  506. bFoldersInitialized = False
  507. End Sub
  508. Private Sub Check_Submit()
  509. Dim DocObject As New FAXCOMEXLib.FaxDocument
  510. Dim RepCol As FaxRecipients
  511. Set RepCol = DocObject.Recipients
  512. Dim FirstRecipient As FaxPersonalProfile
  513. Set FirstRecipient = RepCol.Add("+93 (3) 44")
  514. Dim AttachmentsObject As FaxAttachments
  515. DocObject.Attachments.Add "d:\test\test.txt"
  516. DocObject.ScheduleType = fstSPECIFIC_TIME
  517. DocObject.ScheduleTime = Now + 10
  518. DocObject.Submit ServerObject
  519. Set AttachmentsObject = Nothing
  520. Set FirstRecipient = Nothing
  521. Set DocObject = Nothing
  522. ServerObject.Disconnect
  523. Set ServerObject = Nothing
  524. End Sub