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.

507 lines
15 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmURI
  3. Caption = "Create URI"
  4. ClientHeight = 4215
  5. ClientLeft = 60
  6. ClientTop = 345
  7. ClientWidth = 7695
  8. LinkTopic = "Form1"
  9. ScaleHeight = 4215
  10. ScaleWidth = 7695
  11. StartUpPosition = 3 'Windows Default
  12. Begin VB.TextBox txtOldURI
  13. BackColor = &H8000000F&
  14. Height = 495
  15. Left = 1080
  16. Locked = -1 'True
  17. MultiLine = -1 'True
  18. TabIndex = 7
  19. Tag = "1"
  20. Top = 1680
  21. Width = 6495
  22. End
  23. Begin VB.TextBox txtNewURI
  24. BackColor = &H8000000F&
  25. Height = 495
  26. Left = 1080
  27. Locked = -1 'True
  28. MultiLine = -1 'True
  29. TabIndex = 5
  30. Tag = "1"
  31. Top = 1080
  32. Width = 6495
  33. End
  34. Begin VB.TextBox txtExample
  35. BackColor = &H8000000F&
  36. Height = 495
  37. Left = 1080
  38. Locked = -1 'True
  39. MultiLine = -1 'True
  40. TabIndex = 3
  41. Top = 480
  42. Width = 6495
  43. End
  44. Begin VB.Frame fraVariables
  45. Caption = "Variables"
  46. Height = 1335
  47. Left = 120
  48. TabIndex = 8
  49. Top = 2280
  50. Width = 7455
  51. Begin VB.TextBox txtVariable
  52. Height = 285
  53. Index = 2
  54. Left = 3480
  55. TabIndex = 14
  56. Tag = "1"
  57. Top = 960
  58. Width = 3855
  59. End
  60. Begin VB.TextBox txtVariable
  61. Height = 285
  62. Index = 1
  63. Left = 3480
  64. TabIndex = 12
  65. Tag = "1"
  66. Top = 600
  67. Width = 3855
  68. End
  69. Begin VB.TextBox txtVariable
  70. Height = 285
  71. Index = 0
  72. Left = 3480
  73. TabIndex = 10
  74. Tag = "1"
  75. Top = 240
  76. Width = 3855
  77. End
  78. Begin VB.Label lblVariable
  79. Alignment = 1 'Right Justify
  80. Caption = "Variable2"
  81. Height = 255
  82. Index = 2
  83. Left = 120
  84. TabIndex = 13
  85. Top = 960
  86. Width = 3135
  87. End
  88. Begin VB.Label lblVariable
  89. Alignment = 1 'Right Justify
  90. Caption = "Variable1"
  91. Height = 255
  92. Index = 1
  93. Left = 120
  94. TabIndex = 11
  95. Top = 600
  96. Width = 3135
  97. End
  98. Begin VB.Label lblVariable
  99. Alignment = 1 'Right Justify
  100. Caption = "Variable0"
  101. Height = 255
  102. Index = 0
  103. Left = 120
  104. TabIndex = 9
  105. Top = 240
  106. Width = 3135
  107. End
  108. End
  109. Begin VB.CommandButton cmdCancel
  110. Caption = "Cancel"
  111. Height = 375
  112. Left = 6360
  113. TabIndex = 16
  114. Top = 3720
  115. Width = 1215
  116. End
  117. Begin VB.CommandButton cmdOK
  118. Caption = "OK"
  119. Height = 375
  120. Left = 5040
  121. TabIndex = 15
  122. Top = 3720
  123. Width = 1215
  124. End
  125. Begin VB.ComboBox cboURIType
  126. Height = 315
  127. Left = 1080
  128. TabIndex = 1
  129. Top = 120
  130. Width = 6495
  131. End
  132. Begin VB.Label lblOldURI
  133. Caption = "Old URI:"
  134. Height = 255
  135. Left = 120
  136. TabIndex = 6
  137. Top = 1680
  138. Width = 855
  139. End
  140. Begin VB.Label lblNewURI
  141. Caption = "New URI:"
  142. Height = 255
  143. Left = 120
  144. TabIndex = 4
  145. Top = 1080
  146. Width = 855
  147. End
  148. Begin VB.Label lblExample
  149. Caption = "Example:"
  150. Height = 255
  151. Left = 120
  152. TabIndex = 2
  153. Top = 480
  154. Width = 735
  155. End
  156. Begin VB.Label lblURIType
  157. Caption = "URI Type:"
  158. Height = 255
  159. Left = 120
  160. TabIndex = 0
  161. Top = 120
  162. Width = 855
  163. End
  164. End
  165. Attribute VB_Name = "frmURI"
  166. Attribute VB_GlobalNameSpace = False
  167. Attribute VB_Creatable = False
  168. Attribute VB_PredeclaredId = True
  169. Attribute VB_Exposed = False
  170. Option Explicit
  171. Private Type URIStructure
  172. strDescription As String
  173. intNumVariables As Long
  174. arrStrings() As String
  175. arrVariables() As String
  176. End Type
  177. Private Const MAX_VARIABLES_C As Long = 3
  178. Private Const NUM_URI_TYPES_C As Long = 8
  179. Private p_URIStructures(NUM_URI_TYPES_C - 1) As URIStructure
  180. Private p_clsSizer As Sizer
  181. Private p_strOldURI As String
  182. Private Sub Form_Activate()
  183. cmdOK.Default = True
  184. cmdCancel.Cancel = True
  185. p_SetSizingInfo
  186. p_InitializeURIStructsArray
  187. p_InitializeComboBox
  188. cboURIType_Click
  189. txtOldURI = p_strOldURI
  190. p_SetToolTips
  191. SetFontInternal Me
  192. End Sub
  193. Private Sub Form_Load()
  194. Set p_clsSizer = New Sizer
  195. End Sub
  196. Private Sub Form_Unload(Cancel As Integer)
  197. Set p_clsSizer = Nothing
  198. Set frmURI = Nothing
  199. End Sub
  200. Private Sub Form_Resize()
  201. p_clsSizer.Resize
  202. End Sub
  203. Private Sub cboURIType_Click()
  204. Dim intIndex1 As Long
  205. Dim intIndex2 As Long
  206. Dim UStruct As URIStructure
  207. intIndex1 = cboURIType.ListIndex
  208. If (intIndex1 < 0) Then
  209. txtExample = ""
  210. txtNewURI = ""
  211. p_HideControls 0
  212. Exit Sub
  213. End If
  214. UStruct = p_URIStructures(intIndex1)
  215. txtExample.Text = p_GetExample(UStruct)
  216. For intIndex2 = 0 To UStruct.intNumVariables - 1
  217. lblVariable(intIndex2).Caption = UStruct.arrVariables(intIndex2)
  218. lblVariable(intIndex2).Visible = True
  219. txtVariable(intIndex2).Visible = True
  220. Next
  221. p_HideControls UStruct.intNumVariables
  222. txtVariable_Change 0
  223. End Sub
  224. Private Sub txtVariable_Change(Index As Integer)
  225. Dim intIndex As Long
  226. Dim UStruct As URIStructure
  227. intIndex = cboURIType.ListIndex
  228. If (intIndex < 0) Then
  229. Exit Sub
  230. End If
  231. UStruct = p_URIStructures(intIndex)
  232. txtNewURI.Text = p_GetNewURI(UStruct)
  233. End Sub
  234. Private Sub cmdOK_Click()
  235. frmMain.SetURI txtNewURI
  236. Unload Me
  237. End Sub
  238. Private Sub cmdCancel_Click()
  239. Unload Me
  240. End Sub
  241. Public Sub SetOldURI( _
  242. ByVal i_strURI As String _
  243. )
  244. p_strOldURI = i_strURI
  245. End Sub
  246. Private Sub p_InitializeURIStructsArray()
  247. Dim UStruct As URIStructure
  248. Dim intIndex As Long
  249. UStruct.strDescription = "MS-ITS:%HELP_LOCATION%\<CHM>::/<HTM>"
  250. UStruct.intNumVariables = 2
  251. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  252. UStruct.arrStrings(0) = "MS-ITS:%HELP_LOCATION%\"
  253. UStruct.arrStrings(1) = "::/"
  254. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  255. UStruct.arrVariables(0) = "CHM"
  256. UStruct.arrVariables(1) = "HTM"
  257. p_URIStructures(intIndex) = UStruct
  258. intIndex = intIndex + 1
  259. UStruct.strDescription = "Call a specific SUBSITE"
  260. UStruct.intNumVariables = 1
  261. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  262. UStruct.arrStrings(0) = "hcp://services/subsite?node="
  263. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  264. UStruct.arrVariables(0) = "subsite location"
  265. p_URIStructures(intIndex) = UStruct
  266. intIndex = intIndex + 1
  267. UStruct.strDescription = "Call a specific SUBSITE, with a specific TOPIC open"
  268. UStruct.intNumVariables = 2
  269. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  270. UStruct.arrStrings(0) = "hcp://services/subsite?node="
  271. UStruct.arrStrings(1) = "&topic="
  272. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  273. UStruct.arrVariables(0) = "subsite location"
  274. UStruct.arrVariables(1) = "url of the topic to display"
  275. p_URIStructures(intIndex) = UStruct
  276. intIndex = intIndex + 1
  277. UStruct.strDescription = "Call a specific SUBSITE, with a specific TOPIC open and the appropriate NODE SELECTED"
  278. UStruct.intNumVariables = 3
  279. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  280. UStruct.arrStrings(0) = "hcp://services/subsite?node="
  281. UStruct.arrStrings(1) = "&topic="
  282. UStruct.arrStrings(2) = "&select="
  283. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  284. UStruct.arrVariables(0) = "subsite location"
  285. UStruct.arrVariables(1) = "url of the topic to display"
  286. UStruct.arrVariables(2) = "subnode to highlight"
  287. p_URIStructures(intIndex) = UStruct
  288. intIndex = intIndex + 1
  289. UStruct.strDescription = "Call a topic that takes up the entire bottom pane (both left and right sides)"
  290. UStruct.intNumVariables = 1
  291. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  292. UStruct.arrStrings(0) = "hcp://services/fullwindow?topic="
  293. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  294. UStruct.arrVariables(0) = "url of the topic to display"
  295. p_URIStructures(intIndex) = UStruct
  296. intIndex = intIndex + 1
  297. UStruct.strDescription = "Open an exe from HSS"
  298. UStruct.intNumVariables = 3
  299. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  300. UStruct.arrStrings(0) = "app:"
  301. UStruct.arrStrings(1) = "?arg="
  302. UStruct.arrStrings(2) = "&topic="
  303. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  304. UStruct.arrVariables(0) = "application to launch"
  305. UStruct.arrVariables(1) = "optional arguments"
  306. UStruct.arrVariables(2) = "url of optional topic to display"
  307. p_URIStructures(intIndex) = UStruct
  308. intIndex = intIndex + 1
  309. UStruct.strDescription = "Call a web page in IE"
  310. UStruct.intNumVariables = 2
  311. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  312. UStruct.arrStrings(0) = "app:iexplore.exe?arg="
  313. UStruct.arrStrings(1) = "&topic="
  314. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  315. UStruct.arrVariables(0) = "optional arguments"
  316. UStruct.arrVariables(1) = "url of optional topic to display"
  317. p_URIStructures(intIndex) = UStruct
  318. intIndex = intIndex + 1
  319. UStruct.strDescription = "Call a topic with a switch so that if the .chm isn't there, a default topic appears, telling the user to go and install optional components"
  320. UStruct.intNumVariables = 2
  321. ReDim UStruct.arrStrings(UStruct.intNumVariables - 1)
  322. UStruct.arrStrings(0) = "hcp://services/redirect?online="
  323. UStruct.arrStrings(1) = "&offline="
  324. ReDim UStruct.arrVariables(UStruct.intNumVariables - 1)
  325. UStruct.arrVariables(0) = "url"
  326. UStruct.arrVariables(1) = "backup url"
  327. p_URIStructures(intIndex) = UStruct
  328. intIndex = intIndex + 1
  329. End Sub
  330. Private Sub p_InitializeComboBox()
  331. Dim intIndex As Long
  332. For intIndex = 0 To NUM_URI_TYPES_C - 1
  333. cboURIType.AddItem p_URIStructures(intIndex).strDescription
  334. Next
  335. cboURIType.ListIndex = 0
  336. End Sub
  337. Private Sub p_HideControls(ByVal i_intIndex As Long)
  338. Dim intIndex As Long
  339. For intIndex = i_intIndex To MAX_VARIABLES_C - 1
  340. lblVariable(intIndex).Visible = False
  341. txtVariable(intIndex).Visible = False
  342. Next
  343. End Sub
  344. Private Function p_GetExample( _
  345. ByRef i_UStruct As URIStructure _
  346. ) As String
  347. Dim intIndex As Long
  348. For intIndex = 0 To i_UStruct.intNumVariables - 1
  349. p_GetExample = p_GetExample & _
  350. i_UStruct.arrStrings(intIndex) & _
  351. "<" & i_UStruct.arrVariables(intIndex) & ">"
  352. Next
  353. End Function
  354. Private Function p_GetNewURI( _
  355. ByRef i_UStruct As URIStructure _
  356. ) As String
  357. Dim intIndex As Long
  358. For intIndex = 0 To i_UStruct.intNumVariables - 1
  359. p_GetNewURI = p_GetNewURI & _
  360. i_UStruct.arrStrings(intIndex) & _
  361. txtVariable(intIndex)
  362. Next
  363. End Function
  364. Private Sub p_SetSizingInfo()
  365. Static blnInfoSet As Boolean
  366. Dim intIndex As Long
  367. If (blnInfoSet) Then
  368. Exit Sub
  369. End If
  370. p_clsSizer.AddControl cboURIType
  371. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = Me
  372. p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
  373. p_clsSizer.AddControl txtExample
  374. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = cboURIType
  375. p_clsSizer.AddControl txtNewURI
  376. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = cboURIType
  377. p_clsSizer.AddControl txtOldURI
  378. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = cboURIType
  379. p_clsSizer.AddControl fraVariables
  380. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = cboURIType
  381. For intIndex = 0 To MAX_VARIABLES_C - 1
  382. p_clsSizer.AddControl lblVariable(intIndex)
  383. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = fraVariables
  384. p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
  385. p_clsSizer.Operation(DIM_RIGHT_E) = OP_MULTIPLY_E
  386. p_clsSizer.AddControl txtVariable(intIndex)
  387. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = fraVariables
  388. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  389. p_clsSizer.Operation(DIM_LEFT_E) = OP_MULTIPLY_E
  390. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = fraVariables
  391. p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
  392. Next
  393. p_clsSizer.AddControl cmdOK
  394. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  395. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  396. p_clsSizer.AddControl cmdCancel
  397. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  398. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  399. blnInfoSet = True
  400. End Sub
  401. Private Sub p_SetToolTips()
  402. Dim intIndex As Long
  403. lblURIType.ToolTipText = "Select the desired format of the URI for the selected topic."
  404. cboURIType.ToolTipText = lblURIType.ToolTipText
  405. For intIndex = 0 To MAX_VARIABLES_C - 1
  406. txtVariable(intIndex).ToolTipText = "Type the file or path that matches your selected URI type."
  407. Next
  408. End Sub