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.

402 lines
9.3 KiB

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmHHT
  4. BorderStyle = 1 'Fixed Single
  5. Caption = "Create HHT and CAB"
  6. ClientHeight = 3150
  7. ClientLeft = 45
  8. ClientTop = 330
  9. ClientWidth = 6015
  10. LinkTopic = "Form1"
  11. MaxButton = 0 'False
  12. MinButton = 0 'False
  13. ScaleHeight = 3150
  14. ScaleWidth = 6015
  15. StartUpPosition = 3 'Windows Default
  16. Begin VB.CommandButton cmdCreate
  17. Caption = "Create"
  18. Height = 375
  19. Left = 3360
  20. TabIndex = 14
  21. Top = 2640
  22. Width = 1215
  23. End
  24. Begin VB.CommandButton cmdCancel
  25. Caption = "Cancel"
  26. Height = 375
  27. Left = 4680
  28. TabIndex = 15
  29. Top = 2640
  30. Width = 1215
  31. End
  32. Begin VB.Frame fraSKU
  33. Caption = "SKU"
  34. Height = 1575
  35. Left = 120
  36. TabIndex = 3
  37. Top = 600
  38. Width = 5775
  39. Begin VB.OptionButton optSKU
  40. Caption = "Windows Me"
  41. Height = 255
  42. Index = 0
  43. Left = 120
  44. TabIndex = 4
  45. Top = 240
  46. Width = 2295
  47. End
  48. Begin VB.OptionButton optSKU
  49. Caption = "64-bit Datacenter Server"
  50. Height = 255
  51. Index = 8
  52. Left = 3000
  53. TabIndex = 12
  54. Top = 1200
  55. Width = 2295
  56. End
  57. Begin VB.OptionButton optSKU
  58. Caption = "64-bit Advanced Server"
  59. Height = 255
  60. Index = 6
  61. Left = 3000
  62. TabIndex = 10
  63. Top = 720
  64. Width = 2295
  65. End
  66. Begin VB.OptionButton optSKU
  67. Caption = "64-bit Professional"
  68. Height = 255
  69. Index = 3
  70. Left = 120
  71. TabIndex = 7
  72. Top = 960
  73. Width = 2295
  74. End
  75. Begin VB.OptionButton optSKU
  76. Caption = "32-bit Datacenter Server"
  77. Height = 255
  78. Index = 7
  79. Left = 3000
  80. TabIndex = 11
  81. Top = 960
  82. Width = 2295
  83. End
  84. Begin VB.OptionButton optSKU
  85. Caption = "32-bit Advanced Server"
  86. Height = 255
  87. Index = 5
  88. Left = 3000
  89. TabIndex = 9
  90. Top = 480
  91. Width = 2295
  92. End
  93. Begin VB.OptionButton optSKU
  94. Caption = "32-bit Server"
  95. Height = 255
  96. Index = 4
  97. Left = 3000
  98. TabIndex = 8
  99. Top = 240
  100. Width = 2295
  101. End
  102. Begin VB.OptionButton optSKU
  103. Caption = "32-bit Professional"
  104. Height = 255
  105. Index = 2
  106. Left = 120
  107. TabIndex = 6
  108. Top = 720
  109. Width = 2295
  110. End
  111. Begin VB.OptionButton optSKU
  112. Caption = "32-bit Personal"
  113. Height = 255
  114. Index = 1
  115. Left = 120
  116. TabIndex = 5
  117. Top = 480
  118. Width = 2295
  119. End
  120. End
  121. Begin VB.CommandButton cmdBrowse
  122. Caption = "..."
  123. Height = 315
  124. Left = 5520
  125. TabIndex = 2
  126. Top = 120
  127. Width = 375
  128. End
  129. Begin VB.TextBox txtName
  130. Height = 315
  131. Left = 1080
  132. TabIndex = 1
  133. Top = 120
  134. Width = 4335
  135. End
  136. Begin MSComDlg.CommonDialog dlgFileOpen
  137. Left = 120
  138. Top = 2640
  139. _ExtentX = 847
  140. _ExtentY = 847
  141. _Version = 393216
  142. End
  143. Begin VB.Label lblStatus
  144. BorderStyle = 1 'Fixed Single
  145. Caption = "Entry #1 created"
  146. Height = 255
  147. Left = 120
  148. TabIndex = 13
  149. Top = 2280
  150. Width = 5775
  151. End
  152. Begin VB.Label lblName
  153. Caption = "File Name:"
  154. Height = 255
  155. Left = 120
  156. TabIndex = 0
  157. Top = 120
  158. Width = 855
  159. End
  160. End
  161. Attribute VB_Name = "frmHHT"
  162. Attribute VB_GlobalNameSpace = False
  163. Attribute VB_Creatable = False
  164. Attribute VB_PredeclaredId = True
  165. Attribute VB_Exposed = False
  166. Option Explicit
  167. Private Const DATE_FORMAT_C As String = "Short Date"
  168. Private WithEvents p_clsHHT As AuthDatabase.HHT
  169. Attribute p_clsHHT.VB_VarHelpID = -1
  170. Private Enum SKU_INDEX_E
  171. SI_WINDOWS_MILLENNIUM_E = 0
  172. SI_STANDARD_E = 1
  173. SI_PROFESSIONAL_E = 2
  174. SI_PROFESSIONAL_64_E = 3
  175. SI_SERVER_E = 4
  176. SI_ADVANCED_SERVER_E = 5
  177. SI_ADVANCED_SERVER_64_E = 6
  178. SI_DATA_CENTER_SERVER_E = 7
  179. SI_DATA_CENTER_SERVER_64_E = 8
  180. End Enum
  181. Private Const FILE_FILTER_CAB_C As String = "CAB File (*.cab)|*.cab"
  182. Private p_blnCreating As Boolean
  183. Private p_blnCancelHHTCreation As Boolean
  184. Private Sub Form_Load()
  185. Set p_clsHHT = g_AuthDatabase.HHT
  186. p_blnCreating = False
  187. p_blnCancelHHTCreation = False
  188. p_SetToolTips
  189. End Sub
  190. Private Sub Form_Activate()
  191. optSKU(SI_STANDARD_E).Value = True
  192. lblStatus = ""
  193. p_DisableCreate
  194. cmdCreate.Default = True
  195. cmdCancel.Cancel = True
  196. End Sub
  197. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  198. If (p_blnCreating) Then
  199. cmdCancel_Click
  200. Cancel = True
  201. End If
  202. End Sub
  203. Private Sub Form_Unload(Cancel As Integer)
  204. Set p_clsHHT = Nothing
  205. End Sub
  206. Private Sub txtName_Change()
  207. If (txtName = "") Then
  208. p_DisableCreate
  209. Else
  210. p_EnableCreate
  211. End If
  212. End Sub
  213. Private Sub cmdBrowse_Click()
  214. On Error GoTo LErrorHandler
  215. dlgFileOpen.CancelError = True
  216. dlgFileOpen.Flags = cdlOFNHideReadOnly
  217. dlgFileOpen.Filter = FILE_FILTER_CAB_C
  218. dlgFileOpen.ShowSave
  219. txtName = dlgFileOpen.FileName
  220. LEnd:
  221. Exit Sub
  222. LErrorHandler:
  223. GoTo LEnd
  224. End Sub
  225. Sub cmdCreate_Click()
  226. Dim strName As String
  227. On Error GoTo LErrorHandler
  228. p_blnCreating = True
  229. p_DisableEverythingExceptCancel
  230. p_clsHHT.GenerateCAB txtName, p_GetSelectedSKU
  231. LEnd:
  232. p_blnCreating = False
  233. p_Exit
  234. Exit Sub
  235. LErrorHandler:
  236. Select Case Err.Number
  237. Case cdlCancel, errCancel
  238. ' Nothing. The user cancelled.
  239. Case errDatabaseVersionIncompatible
  240. DisplayDatabaseVersionError
  241. Case Else
  242. g_ErrorInfo.SetInfoAndDump "cmdCreate_Click"
  243. End Select
  244. GoTo LEnd
  245. End Sub
  246. Private Sub cmdCancel_Click()
  247. If (p_blnCreating) Then
  248. p_blnCreating = False
  249. p_blnCancelHHTCreation = True
  250. p_DisableCancel
  251. Else
  252. p_Exit
  253. End If
  254. End Sub
  255. Private Sub p_clsHHT_ReportStatus(ByVal strStatus As String, ByRef blnCancel As Boolean)
  256. lblStatus = strStatus
  257. DoEvents
  258. If (p_blnCancelHHTCreation) Then
  259. blnCancel = True
  260. p_Exit
  261. End If
  262. End Sub
  263. Private Function p_GetSelectedSKU() As SKU_E
  264. If (optSKU(SI_STANDARD_E).Value) Then
  265. p_GetSelectedSKU = SKU_STANDARD_E
  266. ElseIf (optSKU(SI_PROFESSIONAL_E).Value) Then
  267. p_GetSelectedSKU = SKU_PROFESSIONAL_E
  268. ElseIf (optSKU(SI_SERVER_E).Value) Then
  269. p_GetSelectedSKU = SKU_SERVER_E
  270. ElseIf (optSKU(SI_ADVANCED_SERVER_E).Value) Then
  271. p_GetSelectedSKU = SKU_ADVANCED_SERVER_E
  272. ElseIf (optSKU(SI_DATA_CENTER_SERVER_E).Value) Then
  273. p_GetSelectedSKU = SKU_DATA_CENTER_SERVER_E
  274. ElseIf (optSKU(SI_PROFESSIONAL_64_E).Value) Then
  275. p_GetSelectedSKU = SKU_PROFESSIONAL_64_E
  276. ElseIf (optSKU(SI_ADVANCED_SERVER_64_E).Value) Then
  277. p_GetSelectedSKU = SKU_ADVANCED_SERVER_64_E
  278. ElseIf (optSKU(SI_DATA_CENTER_SERVER_64_E).Value) Then
  279. p_GetSelectedSKU = SKU_DATA_CENTER_SERVER_64_E
  280. ElseIf (optSKU(SI_WINDOWS_MILLENNIUM_E).Value) Then
  281. p_GetSelectedSKU = SKU_WINDOWS_MILLENNIUM_E
  282. End If
  283. End Function
  284. Private Sub p_Exit()
  285. Set frmHHT = Nothing
  286. Unload Me
  287. End Sub
  288. Private Sub p_EnableCreate()
  289. cmdCreate.Enabled = True
  290. End Sub
  291. Private Sub p_DisableCreate()
  292. cmdCreate.Enabled = False
  293. End Sub
  294. Private Sub p_DisableCancel()
  295. cmdCancel.Enabled = False
  296. End Sub
  297. Private Sub p_DisableEverythingExceptCancel()
  298. Dim optIndex As Long
  299. lblName.Enabled = False
  300. txtName.Enabled = False
  301. cmdBrowse.Enabled = False
  302. fraSKU.Enabled = False
  303. For optIndex = optSKU.LBound To optSKU.UBound
  304. optSKU(optIndex).Enabled = False
  305. Next
  306. p_DisableCreate
  307. End Sub
  308. Private Sub p_SetToolTips()
  309. lblName.ToolTipText = "Type the path and name of the CAB file to create."
  310. txtName.ToolTipText = lblName.ToolTipText
  311. fraSKU.ToolTipText = "Select the desired SKU for which to create the file."
  312. End Sub