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.

528 lines
16 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmLiveHelpFileImage
  3. Caption = "Live Help File Image Creation Utility"
  4. ClientHeight = 4155
  5. ClientLeft = 5625
  6. ClientTop = 6060
  7. ClientWidth = 6600
  8. LinkTopic = "Form1"
  9. ScaleHeight = 4155
  10. ScaleWidth = 6600
  11. Begin VB.CheckBox chkExpandOnly
  12. Caption = "Check1"
  13. Height = 255
  14. Left = 2400
  15. TabIndex = 17
  16. Top = 3000
  17. Width = 255
  18. End
  19. Begin VB.CheckBox chkInc
  20. Caption = "Check1"
  21. Height = 255
  22. Left = 2400
  23. TabIndex = 16
  24. Top = 2640
  25. Width = 255
  26. End
  27. Begin VB.TextBox txtRenamesFile
  28. Height = 375
  29. Left = 2400
  30. TabIndex = 13
  31. Top = 2160
  32. Width = 3855
  33. End
  34. Begin VB.TextBox txtSSUser
  35. Height = 375
  36. Left = 2400
  37. TabIndex = 1
  38. Top = 720
  39. Width = 3855
  40. End
  41. Begin VB.TextBox txtSSProject
  42. Height = 375
  43. Left = 2400
  44. TabIndex = 2
  45. Top = 1080
  46. Width = 3855
  47. End
  48. Begin VB.CommandButton cmdCLose
  49. Caption = "&Close"
  50. Height = 375
  51. Left = 5520
  52. TabIndex = 6
  53. Top = 3600
  54. Width = 735
  55. End
  56. Begin VB.CommandButton cmdGo
  57. Caption = "&Go"
  58. Height = 375
  59. Left = 4680
  60. TabIndex = 5
  61. Top = 3600
  62. Width = 735
  63. End
  64. Begin VB.TextBox txtWorkDir
  65. Height = 375
  66. Left = 2400
  67. TabIndex = 4
  68. Top = 1800
  69. Width = 3855
  70. End
  71. Begin VB.TextBox txtLiveImageDir
  72. Height = 375
  73. Left = 2400
  74. TabIndex = 3
  75. Top = 1440
  76. Width = 3855
  77. End
  78. Begin VB.TextBox txtSSDB
  79. Height = 375
  80. Left = 2400
  81. TabIndex = 0
  82. Top = 360
  83. Width = 3855
  84. End
  85. Begin VB.Label Label8
  86. Caption = "Expand Only"
  87. Height = 375
  88. Left = 600
  89. TabIndex = 18
  90. Top = 3000
  91. Width = 1815
  92. End
  93. Begin VB.Label Label7
  94. Caption = "Incremental"
  95. Height = 375
  96. Left = 600
  97. TabIndex = 15
  98. Top = 2640
  99. Width = 1815
  100. End
  101. Begin VB.Label lblRenamesFile
  102. Caption = "Renames File"
  103. Height = 375
  104. Left = 600
  105. TabIndex = 14
  106. Top = 2160
  107. Width = 1815
  108. End
  109. Begin VB.Label lblStatus
  110. Height = 375
  111. Left = 600
  112. TabIndex = 12
  113. Top = 3600
  114. Width = 3975
  115. End
  116. Begin VB.Label lblSSUSER
  117. Caption = "SourceSafe User"
  118. Height = 375
  119. Left = 600
  120. TabIndex = 11
  121. Top = 720
  122. Width = 1815
  123. End
  124. Begin VB.Label lblSSProject
  125. Caption = "SourceSafe Project"
  126. Height = 375
  127. Left = 600
  128. TabIndex = 10
  129. Top = 1080
  130. Width = 1815
  131. End
  132. Begin VB.Label lblWorkDir
  133. Caption = "Work Directory"
  134. Height = 375
  135. Left = 600
  136. TabIndex = 9
  137. Top = 1800
  138. Width = 1815
  139. End
  140. Begin VB.Label lblLiveImageDir
  141. Caption = "Live Image Directory"
  142. Height = 375
  143. Left = 600
  144. TabIndex = 8
  145. Top = 1440
  146. Width = 1815
  147. End
  148. Begin VB.Label lblSSDB
  149. Caption = "Sourcesafe Database"
  150. Height = 375
  151. Left = 600
  152. TabIndex = 7
  153. Top = 360
  154. Width = 1815
  155. End
  156. End
  157. Attribute VB_Name = "frmLiveHelpFileImage"
  158. Attribute VB_GlobalNameSpace = False
  159. Attribute VB_Creatable = False
  160. Attribute VB_PredeclaredId = True
  161. Attribute VB_Exposed = False
  162. '===========================================================================================
  163. ' Compiland : frmLiveHelpFileImage.frm
  164. ' Author : Pierre Jacomet
  165. ' Version : 1.0
  166. '
  167. ' Description : Implements Interactive UI and Command Line Wrappers for COM Object
  168. ' that build Live Help File Image for HSC Production Tools.
  169. '
  170. ' Called by : Command Line with Arguments or Interactively from Explorer.
  171. '
  172. ' Environment data:
  173. ' Files that it uses (Specify if they are inherited in open state): NONE
  174. ' Parameters (Command Line) and usage mode {I,I/O,O}:
  175. ' Look in Function ParseOpts() for the latest incarnation of these.
  176. '
  177. ' Parameters (inherited from environment) : NONE
  178. ' Public Variables created: NONE
  179. ' Environment Variables (Public or Module Level) modified: NONE
  180. ' Environment Variables used in coupling with other routines: NONE
  181. ' Local variables : N/A
  182. ' Problems detected :
  183. ' DCR Suggestions:
  184. ' - Make File Copies Incremental, even in those cases where things should be
  185. ' completely destroyed.
  186. '
  187. ' History:
  188. ' 2000-06-18 Initial Creation
  189. '===========================================================================================
  190. Option Explicit
  191. ' We declare the Live Help File Image Com Object with Events in order to be abel to get Status
  192. ' information from it and eventually cancel the run.
  193. Private WithEvents m_oLvi As HSCFileImage.FileImageCreator
  194. Attribute m_oLvi.VB_VarHelpID = -1
  195. ' This function will help us fetch the user. The premise for running the program is that the user running
  196. ' the program MUST be registered with the Source Safe project. Otherwise the program will silently
  197. ' die.
  198. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  199. Private m_bExpandOnly As Boolean
  200. Private Sub chkExpandOnly_Click()
  201. m_bExpandOnly = Not m_bExpandOnly
  202. With Me
  203. .txtRenamesFile.Enabled = Not m_bExpandOnly
  204. .txtSSDB.Enabled = Not m_bExpandOnly
  205. .txtSSProject.Enabled = Not m_bExpandOnly
  206. .txtRenamesFile.Visible = Not m_bExpandOnly
  207. .txtSSDB.Visible = Not m_bExpandOnly
  208. .txtSSProject.Visible = Not m_bExpandOnly
  209. .lblRenamesFile.Visible = Not m_bExpandOnly
  210. .lblSSDB.Visible = Not m_bExpandOnly
  211. .lblSSProject.Visible = Not m_bExpandOnly
  212. .txtSSUser.Visible = Not m_bExpandOnly
  213. .lblSSUSER.Visible = Not m_bExpandOnly
  214. End With
  215. End Sub
  216. Private Sub cmdCLose_Click()
  217. Unload Me
  218. End Sub
  219. Private Sub cmdGo_Click()
  220. Dim strErrMsg As String: strErrMsg = "": If (g_bOnErrorHandling) Then On Error GoTo Error_Handler
  221. If (Not m_oLvi.Init((Me.chkInc = vbChecked))) Then
  222. MsgBox "Could Not Initialize FileImageCreator Object", vbCritical, "Inite Error", ""
  223. GoTo Common_Exit
  224. End If
  225. ' While we work, we disable all Data Entry except for the Cancel Button.
  226. cmdGo.Enabled = False
  227. cmdCLose.Caption = "&Cancel"
  228. With Me
  229. .txtLiveImageDir.Enabled = False
  230. .txtRenamesFile.Enabled = False
  231. .txtSSDB.Enabled = False
  232. .txtSSProject.Enabled = False
  233. .txtWorkDir.Enabled = False
  234. .chkExpandOnly.Enabled = False
  235. .chkInc.Enabled = False
  236. End With
  237. m_oLvi.LiveImageDir = txtLiveImageDir
  238. m_oLvi.WorkDir = txtWorkDir
  239. If (Me.chkExpandOnly) Then
  240. m_oLvi.ExpandChmOnly = True
  241. Else
  242. ' Now we load everything into the Com Object and then we hit GO.
  243. m_oLvi.SSDB = txtSSDB
  244. m_oLvi.ssuser = txtSSUser
  245. m_oLvi.SSProject = txtSSProject
  246. m_oLvi.RenamesFile = txtRenamesFile
  247. End If
  248. m_oLvi.Go
  249. ' We are done, so let's get out.
  250. cmdGo.Caption = "Done"
  251. cmdCLose.Caption = "&Close"
  252. Common_Exit:
  253. Exit Sub
  254. Error_Handler:
  255. g_XErr.SetInfo "frmLiveHelpFileImage::cmdGo_Click", strErrMsg
  256. g_XErr.Dump
  257. End Sub
  258. Private Sub Form_Load()
  259. If (Not GlobalInit) Then
  260. MsgBox "Could Not Initialize"
  261. Unload Me
  262. GoTo Common_Exit
  263. End If
  264. Dim strErrMsg As String: strErrMsg = "": If (g_bOnErrorHandling) Then On Error GoTo Error_Handler
  265. Set m_oLvi = New HSCFileImage.FileImageCreator
  266. txtSSUser.Enabled = False
  267. Dim ssuser As String: ssuser = Space$(100)
  268. GetUserName ssuser, 100
  269. txtSSUser = ssuser
  270. If (Len(Command$) = 0) Then
  271. ' Temporary default FileNames. They should not be taken as indicative of
  272. ' anything.
  273. ' txtSSDB = "\\atlantica\vss"
  274. ' txtSSProject = "$/Whistler/usa/WhistlerAllHelp/_Server"
  275. ' txtLiveImageDir = "\\pietrino\HlpImages\Server\winnt\help"
  276. ' txtWorkDir = "\\pietrino\HSCExpChms\Server\winnt\help"
  277. ' txtRenamesFile = "C:\inet\helpctr\LiveHelpImage\ServerRen.bat"
  278. txtLiveImageDir = "\\taos\public\Builds\Whistler\Latest\Pro"
  279. txtWorkDir = "\\pietrino\HSCExpChms\Pro\winnt\help"
  280. chkInc.Value = False
  281. Else
  282. doWork Command$
  283. Unload Me
  284. End If
  285. Common_Exit:
  286. Exit Sub
  287. Error_Handler:
  288. ' We will hit an Err.Number of vbObject + 9999 by Normal Exit Conditions,
  289. ' so we are not interested in dumping this information.
  290. If (Err.Number = (vbObject + 9999)) Then
  291. Unload Me
  292. Else
  293. g_XErr.Dump
  294. End If
  295. GoTo Common_Exit
  296. End Sub
  297. Private Sub m_oLvi_GoStatus(strWhere As String, bCancel As Boolean)
  298. lblStatus.Caption = strWhere
  299. End Sub
  300. ' ============= Command Line Interface ====================
  301. ' Function: Parseopts
  302. ' Objective : Supplies a Command Line arguments interface for creating the Live Help File Image.
  303. '
  304. ' Hsclhi [/INC] /SSDB \\atlantica\vss /SSPROJ $/Whistler/usa/WhistlerAllHelp/_Server
  305. ' /LVIDIR \\pietrino\d$\public\HlpImages\Server\winnt\help
  306. ' /WORKDIR \\pietrino\d$\public\HSCExpChms\Server\winnt\help
  307. ' /RENLIST C:\inet\helpctr\LiveHelpImage\ServerRen.bat
  308. Function ParseOpts(ByVal strCmd As String) As Boolean
  309. Dim strErrMsg As String: strErrMsg = "": If (g_bOnErrorHandling) Then On Error GoTo Error_Handler
  310. Dim lProgOpt As Long
  311. Dim iError As Long
  312. Const OPT_SSDB As Long = 2 ^ 0
  313. Const OPT_SSPROJ As Long = 2 ^ 1
  314. Const OPT_LVIDIR As Long = 2 ^ 2
  315. Const OPT_WORKDIR As Long = 2 ^ 3
  316. Const OPT_RENLIST As Long = 2 ^ 4
  317. Const OPT_INC As Long = 2 ^ 5
  318. Const OPT_EXPANDONLY As Long = 2 ^ 6
  319. Dim strArg As String
  320. While (Len(strCmd) > 0 And iError = 0)
  321. strCmd = Trim$(strCmd)
  322. If Left$(strCmd, 1) = Chr(34) Then
  323. strCmd = Right$(strCmd, Len(strCmd) - 1)
  324. strArg = vntGetTok(strCmd, sTokSepIN:=Chr(34))
  325. Else
  326. strArg = vntGetTok(strCmd, sTokSepIN:=" ")
  327. End If
  328. If (Left$(strArg, 1) = "/" Or Left$(strArg, 1) = "-") Then
  329. strArg = Mid$(strArg, 2)
  330. Select Case UCase$(strArg)
  331. ' All the Cases are in alphabetical order to make your life
  332. ' easier to go through them. There are a couple of exceptions.
  333. ' The first one is that every NOXXX option goes after the
  334. ' pairing OPTION.
  335. Case "EXPANDONLY"
  336. lProgOpt = (lProgOpt Or OPT_EXPANDONLY)
  337. Me.chkExpandOnly = vbChecked
  338. Case "INC"
  339. lProgOpt = (lProgOpt Or OPT_INC)
  340. Me.chkInc = vbChecked
  341. Case "SSDB"
  342. strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
  343. If ("\\" = Left$(strArg, 2)) Then
  344. lProgOpt = lProgOpt Or OPT_SSDB
  345. Me.txtSSDB = strArg
  346. Else
  347. MsgBox ("A source safe database must be specified using UNC '\\' style notation")
  348. iError = 1
  349. End If
  350. Case "SSPROJ"
  351. strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
  352. If ("$/" = Left$(strArg, 2)) Then
  353. lProgOpt = lProgOpt Or OPT_SSPROJ
  354. Me.txtSSProject = strArg
  355. Else
  356. MsgBox ("A source safe project must be specified using '$/' style notation")
  357. iError = 1
  358. End If
  359. Case "LVIDIR"
  360. strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
  361. If ("\\" = Left$(strArg, 2)) Then
  362. lProgOpt = lProgOpt Or OPT_LVIDIR
  363. Me.txtLiveImageDir = strArg
  364. Else
  365. MsgBox ("Live Image Directory must be specified using UNC '\\' style notation")
  366. iError = 1
  367. End If
  368. Case "WORKDIR"
  369. strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
  370. If ("\\" = Left$(strArg, 2)) Then
  371. lProgOpt = lProgOpt Or OPT_WORKDIR
  372. Me.txtWorkDir = strArg
  373. Else
  374. MsgBox ("Working Directory must be specified using UNC '\\' style notation")
  375. iError = 1
  376. End If
  377. Case "RENLIST"
  378. strArg = vntGetTok(strCmd, sTokSepIN:=" ")
  379. If (Not (IsFullPathname(strArg) And FileExists(strArg))) Then
  380. MsgBox ("Cannot open Renames file " & strArg & ". Make sure you type a Full Pathname")
  381. iError = 1
  382. lProgOpt = (lProgOpt And (Not OPT_RENLIST))
  383. Else
  384. Me.txtRenamesFile = strArg
  385. lProgOpt = (lProgOpt Or OPT_RENLIST)
  386. End If
  387. Case Else
  388. MsgBox "Program Option: " & "/" & strArg & " is not supported", vbOKOnly, "Program Arguments Error"
  389. lProgOpt = 0
  390. iError = 1
  391. End Select
  392. End If
  393. Wend
  394. ' Now we check for a complete and <coherent> list of options. As all options are
  395. ' mandatory then we check for ALL options being set.
  396. If ((lProgOpt And OPT_EXPANDONLY) = OPT_EXPANDONLY) Then
  397. If ((lProgOpt And (OPT_SSDB Or OPT_SSPROJ Or OPT_RENLIST)) <> 0 Or _
  398. (lProgOpt And (OPT_WORKDIR Or OPT_LVIDIR)) <> (OPT_WORKDIR Or OPT_LVIDIR) _
  399. ) Then
  400. UseageMsg
  401. iError = 1
  402. End If
  403. Else
  404. If ((lProgOpt And (OPT_SSDB Or OPT_SSPROJ Or OPT_LVIDIR Or OPT_WORKDIR Or OPT_RENLIST)) <> _
  405. (OPT_SSDB Or OPT_SSPROJ Or OPT_LVIDIR Or OPT_WORKDIR Or OPT_RENLIST)) Then
  406. UseageMsg
  407. iError = 1
  408. End If
  409. End If
  410. ParseOpts = (0 = iError)
  411. Exit Function
  412. Error_Handler:
  413. g_XErr.SetInfo "frmLiveHelpFileImage::ParseOpts", strErrMsg
  414. Err.Raise Err.Number
  415. End Function
  416. Sub doWork(ByVal strCmd As String)
  417. Dim strErrMsg As String: strErrMsg = "": If (g_bOnErrorHandling) Then On Error GoTo Error_Handler
  418. If Not ParseOpts(strCmd) Then
  419. GoTo Common_Exit
  420. End If
  421. Me.Show vbModeless
  422. cmdGo_Click
  423. Common_Exit:
  424. Exit Sub
  425. Error_Handler:
  426. g_XErr.SetInfo "frmLiveHelpFileImage::doWork", strErrMsg
  427. Err.Raise Err.Number
  428. End Sub
  429. Sub UseageMsg()
  430. MsgBox "HSCLHI [/EXPANDONLY] [/INC]" + vbCr + _
  431. " [/SSDB \\atlantica\vss]" + vbCr + _
  432. " [/SSPROJ $/Whistler/usa/WhistlerAllHelp/_Server]" + vbCrLf + _
  433. " [/LVIDIR \\pietrino\d$\public\HlpImages\Server\winnt\help]" + vbCrLf + _
  434. " /WORKDIR \\pietrino\d$\public\HSCExpChms\Server\winnt\help" + vbCrLf + _
  435. " [/RENLIST C:\inet\helpctr\LiveHelpImage\ServerRen.bat]" + vbCrLf + vbCrLf + _
  436. "Where each option means:" + vbCrLf + vbCrLf + _
  437. "/EXPANDONLY We start from an existing Live Help File Image, we only need to expand" + vbCr + _
  438. "/INC Incremental Mode" + vbCr + _
  439. "/SSDB Source Safe Database to use" + vbCr + _
  440. "/SSPROJ Project within the Source Safe Database" + vbCr + _
  441. "/LVIDIR Destination Live Help File Image Directory" + vbCr + _
  442. "/WORKDIR HSC Work Directory" + vbCr + _
  443. "/RENLIST Rename Batch File to be applied after Getting files from Source Safe", vbOKOnly, "HSCLHI Program Usage"
  444. End Sub