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.

187 lines
4.1 KiB

  1. '//+----------------------------------------------------------------------------
  2. '//
  3. '// File: newpb.frm
  4. '//
  5. '// Module: pbadmin.exe
  6. '//
  7. '// Synopsis: The new phonebook form.
  8. '//
  9. '// Copyright (c) 1997-1999 Microsoft Corporation
  10. '//
  11. '// Author: quintinb Created Header 09/02/99
  12. '//
  13. '//+----------------------------------------------------------------------------
  14. VERSION 5.00
  15. Begin VB.Form frmNewPB
  16. BorderStyle = 3 'Fixed Dialog
  17. ClientHeight = 2445
  18. ClientLeft = 4890
  19. ClientTop = 2310
  20. ClientWidth = 3390
  21. Icon = "NewPB.frx":0000
  22. KeyPreview = -1 'True
  23. LinkTopic = "Form1"
  24. MaxButton = 0 'False
  25. MinButton = 0 'False
  26. PaletteMode = 1 'UseZOrder
  27. ScaleHeight = 2445
  28. ScaleWidth = 3390
  29. ShowInTaskbar = 0 'False
  30. WhatsThisButton = -1 'True
  31. WhatsThisHelp = -1 'True
  32. Begin VB.TextBox NewPBText
  33. Height = 315
  34. Left = 600
  35. MaxLength = 8
  36. TabIndex = 1
  37. Top = 1530
  38. WhatsThisHelpID = 12010
  39. Width = 2355
  40. End
  41. Begin VB.CommandButton cmbCancel
  42. Cancel = -1 'True
  43. Caption = "cancel"
  44. Height = 375
  45. Left = 1830
  46. TabIndex = 3
  47. Top = 1935
  48. WhatsThisHelpID = 10040
  49. Width = 1185
  50. End
  51. Begin VB.CommandButton cmbOK
  52. Caption = "ok"
  53. Default = -1 'True
  54. Enabled = 0 'False
  55. Height = 360
  56. Left = 480
  57. TabIndex = 2
  58. Top = 1935
  59. WhatsThisHelpID = 10030
  60. Width = 1200
  61. End
  62. Begin VB.Label DescLabel
  63. BackStyle = 0 'Transparent
  64. Caption = "enter a new name..."
  65. Height = 1080
  66. Left = 135
  67. TabIndex = 4
  68. Top = 90
  69. Width = 3060
  70. End
  71. Begin VB.Label NewLabel
  72. BackStyle = 0 'Transparent
  73. Caption = "new pb"
  74. Height = 240
  75. Left = 600
  76. TabIndex = 0
  77. Top = 1275
  78. WhatsThisHelpID = 12010
  79. Width = 2655
  80. End
  81. End
  82. Attribute VB_Name = "frmNewPB"
  83. Attribute VB_GlobalNameSpace = False
  84. Attribute VB_Creatable = False
  85. Attribute VB_PredeclaredId = True
  86. Attribute VB_Exposed = False
  87. Option Explicit
  88. Public strPB As String
  89. Private Sub cmbCancel_Click()
  90. 'Unload Me
  91. Me.Hide
  92. End Sub
  93. Private Sub cmbOK_Click()
  94. ' mainly make sure that they've entered
  95. ' a unique pb name and then just do it.
  96. Dim strNewPB As String
  97. Dim strTemp As String
  98. Dim strINFfile As String
  99. Dim varRegKeys As Variant
  100. Dim intX As Integer
  101. Dim rt As Integer
  102. On Error GoTo ErrTrap
  103. strNewPB = Trim(NewPBText.Text)
  104. Screen.MousePointer = 11
  105. rt = CreatePB(strNewPB)
  106. If rt = 0 Then
  107. Me.Hide
  108. strPB = strNewPB
  109. Else
  110. NewPBText.SetFocus
  111. NewPBText.SelStart = 0
  112. NewPBText.SelLength = Len(NewPBText.Text)
  113. End If
  114. Screen.MousePointer = 0
  115. Exit Sub
  116. ErrTrap:
  117. Exit Sub
  118. End Sub
  119. Private Sub Form_KeyPress(KeyAscii As Integer)
  120. CheckChar KeyAscii
  121. End Sub
  122. Private Sub Form_Load()
  123. strPB = ""
  124. CenterForm Me, Screen
  125. LoadNewRes
  126. End Sub
  127. Function LoadNewRes()
  128. On Error GoTo LoadErr
  129. Me.Caption = LoadResString(4067)
  130. DescLabel.Caption = LoadResString(4068)
  131. NewLabel.Caption = LoadResString(4069)
  132. cmbOK.Caption = LoadResString(1002)
  133. cmbCancel.Caption = LoadResString(1003)
  134. ' set fonts
  135. SetFonts Me
  136. On Error GoTo 0
  137. Exit Function
  138. LoadErr:
  139. Exit Function
  140. End Function
  141. Private Sub NewPBText_Change()
  142. If Trim$(NewPBText.Text) <> "" Then
  143. cmbOK.Enabled = True
  144. Else
  145. cmbOK.Enabled = False
  146. End If
  147. End Sub
  148. Private Sub NewPBText_KeyPress(KeyAscii As Integer)
  149. KeyAscii = FilterPBKey(KeyAscii, NewPBText)
  150. End Sub