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.

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