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.

361 lines
8.5 KiB

  1. '//+----------------------------------------------------------------------------
  2. '//
  3. '// File: cab.frm
  4. '//
  5. '// Module: pbadmin.exe
  6. '//
  7. '// Synopsis: The options dialog in PBA
  8. '//
  9. '// Copyright (c) 1997-1999 Microsoft Corporation
  10. '//
  11. '// Author: quintinb Created Header 09/02/99
  12. '//
  13. '//+----------------------------------------------------------------------------
  14. VERSION 5.00
  15. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  16. Begin VB.Form frmCab
  17. BorderStyle = 3 'Fixed Dialog
  18. Caption = "options"
  19. ClientHeight = 2595
  20. ClientLeft = 2775
  21. ClientTop = 1545
  22. ClientWidth = 5955
  23. Icon = "cab.frx":0000
  24. KeyPreview = -1 'True
  25. LinkTopic = "Form1"
  26. LockControls = -1 'True
  27. MaxButton = 0 'False
  28. MinButton = 0 'False
  29. PaletteMode = 1 'UseZOrder
  30. ScaleHeight = 2595
  31. ScaleWidth = 5955
  32. ShowInTaskbar = 0 'False
  33. WhatsThisButton = -1 'True
  34. WhatsThisHelp = -1 'True
  35. Begin VB.CommandButton Command1
  36. Cancel = -1 'True
  37. Caption = "cancel"
  38. Height = 375
  39. Left = 4425
  40. TabIndex = 7
  41. Top = 2070
  42. WhatsThisHelpID = 10040
  43. Width = 1335
  44. End
  45. Begin VB.CommandButton cmbcab
  46. Caption = "ok"
  47. Default = -1 'True
  48. Height = 375
  49. Left = 4410
  50. TabIndex = 6
  51. Top = 1530
  52. WhatsThisHelpID = 10030
  53. Width = 1335
  54. End
  55. Begin VB.TextBox txtUrl
  56. Height = 285
  57. Left = 225
  58. MaxLength = 100
  59. TabIndex = 1
  60. Top = 495
  61. WhatsThisHelpID = 70000
  62. Width = 5520
  63. End
  64. Begin VB.TextBox UIDText
  65. Height = 315
  66. Left = 210
  67. MaxLength = 64
  68. TabIndex = 3
  69. Top = 1350
  70. WhatsThisHelpID = 70010
  71. Width = 2730
  72. End
  73. Begin VB.TextBox PWDText
  74. Height = 330
  75. IMEMode = 3 'DISABLE
  76. Left = 225
  77. MaxLength = 64
  78. PasswordChar = "*"
  79. TabIndex = 5
  80. Top = 2085
  81. WhatsThisHelpID = 70020
  82. Width = 2715
  83. End
  84. Begin MSComDlg.CommonDialog CommonDialog1
  85. Left = 2940
  86. Top = -30
  87. _ExtentX = 847
  88. _ExtentY = 847
  89. _Version = 393216
  90. End
  91. Begin VB.Label ServerLabel
  92. BackStyle = 0 'Transparent
  93. Caption = "server"
  94. Height = 255
  95. Left = 210
  96. TabIndex = 0
  97. Top = 240
  98. WhatsThisHelpID = 70000
  99. Width = 5520
  100. End
  101. Begin VB.Label UIDLabel
  102. BackStyle = 0 'Transparent
  103. Caption = "uid"
  104. Height = 255
  105. Left = 225
  106. TabIndex = 2
  107. Top = 1125
  108. WhatsThisHelpID = 70010
  109. Width = 2790
  110. End
  111. Begin VB.Label pwdLabel
  112. BackStyle = 0 'Transparent
  113. Caption = "pwd"
  114. Height = 270
  115. Left = 225
  116. TabIndex = 4
  117. Top = 1815
  118. WhatsThisHelpID = 70020
  119. Width = 2670
  120. End
  121. End
  122. Attribute VB_Name = "frmcab"
  123. Attribute VB_GlobalNameSpace = False
  124. Attribute VB_Creatable = False
  125. Attribute VB_PredeclaredId = True
  126. Attribute VB_Exposed = False
  127. Option Explicit
  128. Dim configuration As Recordset
  129. Function LoadOptionsRes()
  130. Dim cRef As Integer
  131. On Error GoTo LoadErr
  132. cRef = 5200
  133. Me.Caption = LoadResString(cRef + 25) & " " & gsCurrentPB
  134. ServerLabel.Caption = LoadResString(cRef + 21)
  135. UIDLabel.Caption = LoadResString(cRef + 22)
  136. pwdLabel.Caption = LoadResString(cRef + 23)
  137. cmbcab.Caption = LoadResString(1002)
  138. Command1.Caption = LoadResString(1003)
  139. ' set fonts
  140. SetFonts Me
  141. On Error GoTo 0
  142. Exit Function
  143. LoadErr:
  144. Exit Function
  145. End Function
  146. Function TrimURL(URL As String) As String
  147. URL = Trim(URL)
  148. TrimURL = URL
  149. If LCase(Left(URL, 4)) = "ftp:" Then
  150. TrimURL = Right(URL, Len(URL) - 4)
  151. End If
  152. If LCase(Left(URL, 5)) = "http:" Then
  153. TrimURL = Right(URL, Len(URL) - 5)
  154. End If
  155. Do While Left(TrimURL, 1) = "/"
  156. TrimURL = Right(TrimURL, Len(TrimURL) - 1)
  157. Loop
  158. Do While Left(TrimURL, 1) = "\"
  159. TrimURL = Right(TrimURL, Len(TrimURL) - 1)
  160. Loop
  161. End Function
  162. Private Sub cmbcab_Click()
  163. Dim rt As Integer
  164. Screen.MousePointer = 11
  165. rt = SetOptions(txtUrl.Text, UIDText.Text, PWDText.Text)
  166. If rt = 1 Then
  167. UIDText.SetFocus
  168. ElseIf rt = 2 Then
  169. PWDText.SetFocus
  170. End If
  171. Screen.MousePointer = 0
  172. Unload Me
  173. Exit Sub
  174. ErrTrap:
  175. Screen.MousePointer = 0
  176. MsgBox LoadResString(6056) & Chr(13) & Chr(13) & Err.Description, vbExclamation
  177. Exit Sub
  178. Exit Sub
  179. End Sub
  180. Private Sub Command1_Click()
  181. Unload Me
  182. End Sub
  183. Private Sub Form_Activate()
  184. txtUrl.SetFocus
  185. End Sub
  186. Private Sub Form_KeyPress(KeyAscii As Integer)
  187. CheckChar KeyAscii
  188. End Sub
  189. Private Sub Form_Load()
  190. Dim RS, configuration As Recordset
  191. Dim i As Integer
  192. Dim myPos As Integer
  193. On Error GoTo LoadErr
  194. If gsCurrentPB = "" Then
  195. Exit Sub
  196. End If
  197. CenterForm Me, Screen
  198. 'SSTab1.Tab = 0
  199. LoadOptionsRes
  200. Set configuration = gsyspb.OpenRecordset("Configuration", dbOpenSnapshot)
  201. If configuration.RecordCount <> 0 Then
  202. If Not IsNull(configuration!URL) Then
  203. txtUrl.Text = configuration!URL
  204. End If
  205. If Not IsNull(configuration!ServerPWD) Then
  206. PWDText.Text = configuration!ServerPWD
  207. End If
  208. If Not IsNull(configuration!ServerUID) Then
  209. UIDText.Text = configuration!ServerUID
  210. End If
  211. End If
  212. configuration.Close
  213. Set configuration = Nothing
  214. Screen.MousePointer = 0
  215. Exit Sub
  216. LoadErr:
  217. Screen.MousePointer = 0
  218. MsgBox LoadResString(6056) & Chr(13) & Chr(13) & Err.Description, vbExclamation
  219. End Sub
  220. Private Sub LoadList(list As Control, sTableName As String, sName As String, sID As String)
  221. Dim RS As Recordset
  222. list.Clear
  223. Set Gsyspbpost = DBEngine.Workspaces(0).OpenDatabase(locPath + "pbserver.mdb")
  224. Set RS = Gsyspbpost.OpenRecordset("SELECT " & sName & "," & sID & " FROM " & sTableName)
  225. While Not RS.EOF
  226. list.AddItem RS(sName)
  227. list.ItemData(list.NewIndex) = RS(sID)
  228. RS.MoveNext
  229. Wend
  230. RS.Close
  231. Gsyspbpost.Close
  232. End Sub
  233. Sub selectListItem(list As Control, ByVal ID As Long)
  234. Dim i As Integer
  235. For i = 0 To list.ListCount - 1
  236. If list.ItemData(i) = ID Then
  237. list.Selected(i) = True
  238. End If
  239. Next i
  240. End Sub
  241. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  242. If UnloadMode = vbFormControlMenu Then
  243. Cancel = False
  244. Command1_Click
  245. End If
  246. End Sub
  247. Private Sub Form_Unload(Cancel As Integer)
  248. Set configuration = Nothing
  249. End Sub
  250. Private Sub PWDText_GotFocus()
  251. SelectText PWDText
  252. End Sub
  253. Private Sub txtUrl_GotFocus()
  254. SelectText txtUrl
  255. End Sub
  256. Private Sub txtUrl_KeyPress(KeyAscii As Integer)
  257. Select Case KeyAscii
  258. Case 32 'space
  259. KeyAscii = 0
  260. Beep
  261. 'MsgBox LoadResString(6018), vbInformation
  262. End Select
  263. End Sub
  264. Private Sub UIDText_GotFocus()
  265. SelectText UIDText
  266. End Sub
  267. Private Sub UIDText_KeyPress(KeyAscii As Integer)
  268. Select Case KeyAscii
  269. '0-9 a-z A-Z Bkspc ctrl-C ctrl-V
  270. 'Case 48 To 57, 97 To 122, 65 To 90, 8, 3, 22
  271. ' do nothing
  272. ' upper case
  273. 'Case 48 To 57
  274. ' KeyAscii = KeyAscii + 32 ' shift to lower case
  275. 'Case Else
  276. ' KeyAscii = 0
  277. ' Beep
  278. ' MsgBox LoadResString(6018), vbInformation
  279. Case 32 'space
  280. KeyAscii = 0
  281. Beep
  282. Case Else
  283. 'do nothing
  284. End Select
  285. End Sub