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.

233 lines
5.8 KiB

  1. '//+----------------------------------------------------------------------------
  2. '//
  3. '// File: print.frm
  4. '//
  5. '// Module: pbadmin.exe
  6. '//
  7. '// Synopsis: The dialog displayed while printing the POP list 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. Begin VB.Form frmPrinting
  16. BorderStyle = 3 'Fixed Dialog
  17. ClientHeight = 1275
  18. ClientLeft = 3180
  19. ClientTop = 1650
  20. ClientWidth = 3735
  21. ControlBox = 0 'False
  22. Icon = "Print.frx":0000
  23. KeyPreview = -1 'True
  24. LinkTopic = "Form1"
  25. LockControls = -1 'True
  26. MaxButton = 0 'False
  27. MinButton = 0 'False
  28. PaletteMode = 1 'UseZOrder
  29. ScaleHeight = 1275
  30. ScaleWidth = 3735
  31. ShowInTaskbar = 0 'False
  32. Begin VB.CommandButton cmdCancel
  33. Caption = "cancel"
  34. Height = 360
  35. Left = 1260
  36. TabIndex = 0
  37. Top = 840
  38. Width = 1065
  39. End
  40. Begin VB.Label StatusText
  41. Caption = "printing"
  42. Height = 675
  43. Left = 180
  44. TabIndex = 1
  45. Top = 120
  46. Width = 3315
  47. End
  48. End
  49. Attribute VB_Name = "frmPrinting"
  50. Attribute VB_GlobalNameSpace = False
  51. Attribute VB_Creatable = False
  52. Attribute VB_PredeclaredId = True
  53. Attribute VB_Exposed = False
  54. Option Explicit
  55. Public Cancelled As Boolean
  56. Public JobType As Byte
  57. Public JobParm1 As String
  58. Function PrintPhoneFiles()
  59. ' note: temp is a global recordset
  60. ' JobParm1 is the delta number here
  61. Dim deltanum As Integer
  62. Dim sqlstm As String
  63. On Error GoTo PrintErr
  64. Screen.MousePointer = 13
  65. deltanum = Val(JobParm1)
  66. If deltanum <> 0 Then
  67. sqlstm = "SELECT DISTINCTROW * From delta WHERE DeltaNum = " & deltanum & " and NewVersion <> 1 order by CityName"
  68. Else
  69. sqlstm = "SELECT * from DialUpPort where Status = '1' order by CityName"
  70. End If
  71. Set temp = GsysPb.OpenRecordset(sqlstm, dbOpenSnapshot)
  72. If Not (temp.EOF And temp.BOF) Then
  73. Do While Not temp.EOF
  74. If temp!CityName = "" Or IsNull(temp!CityName) Then
  75. Printer.Print temp!AccessNumberId; ",";
  76. Printer.Print "0"; ","; "0"; ","; "0"; ","; "0"; ","; "0"; ",";
  77. Printer.Print "0"; ","; "0"; ","; "0"; ","; "0"; ","; "0"
  78. Else
  79. Printer.Print Trim(temp!AccessNumberId); ",";
  80. Printer.Print Trim(temp!CountryNumber); ",";
  81. Printer.Print Trim(temp!regionID); ",";
  82. Printer.Print temp!CityName; ",";
  83. Printer.Print Trim(temp!AreaCode); ",";
  84. Printer.Print Trim(temp!AccessNumber); ",";
  85. Printer.Print Trim(temp!MinimumSpeed); ",";
  86. Printer.Print Trim(temp!MaximumSpeed); ",";
  87. Printer.Print "0"; ",";
  88. Printer.Print Trim(temp!Flags); ",";
  89. Printer.Print temp!ScriptID
  90. End If
  91. temp.MoveNext
  92. If temp.AbsolutePosition Mod 55 = 0 Then Printer.NewPage
  93. DoEvents
  94. If Cancelled Then
  95. Exit Do
  96. End If
  97. Loop
  98. If Not Cancelled Then
  99. Printer.EndDoc
  100. Else
  101. Printer.KillDoc
  102. End If
  103. End If
  104. temp.Close
  105. Set temp = Nothing
  106. Screen.MousePointer = 0
  107. Unload frmPrinting
  108. Exit Function
  109. PrintErr:
  110. Exit Function
  111. End Function
  112. Function PrintMainPOPList()
  113. Dim intX, intY As Integer
  114. Dim PrintList As ListView
  115. On Error GoTo PrintErr
  116. Screen.MousePointer = 13
  117. Set PrintList = frmMain.PopList
  118. intX = 1
  119. Do While intX <= PrintList.ListItems.Count
  120. Printer.Print PrintList.ListItems(intX).Text; ",";
  121. For intY = 1 To 5
  122. Printer.Print PrintList.ListItems(intX).SubItems(intY); ",";
  123. Next
  124. Printer.Print "" 'end the line
  125. DoEvents
  126. If frmPrinting.Cancelled Or _
  127. intX = PrintList.ListItems.Count Then Exit Do
  128. If intX Mod 55 = 0 Then Printer.NewPage
  129. intX = intX + 1
  130. Loop
  131. If Cancelled Then
  132. Printer.KillDoc
  133. Else
  134. Printer.EndDoc
  135. End If
  136. Set PrintList = Nothing
  137. Screen.MousePointer = 0
  138. Unload frmPrinting
  139. Exit Function
  140. PrintErr:
  141. Exit Function
  142. End Function
  143. Public Function StartPrint()
  144. Screen.MousePointer = 13
  145. If Printers.Count = 0 Then
  146. Screen.MousePointer = 0
  147. MsgBox LoadResString(6019), vbInformation
  148. Unload frmPrinting
  149. Exit Function
  150. End If
  151. Select Case JobType
  152. Case 1
  153. PrintPhoneFiles
  154. Case 2
  155. PrintMainPOPList
  156. End Select
  157. Screen.MousePointer = 0
  158. End Function
  159. Public Function SetMessage(Message As String) As Integer
  160. On Error GoTo SetMsgErr
  161. StatusText.Caption = Message
  162. DoEvents
  163. Exit Function
  164. SetMsgErr:
  165. Exit Function
  166. End Function
  167. Private Sub cmdCancel_Click()
  168. Cancelled = True
  169. Me.Enabled = False
  170. frmPrinting.Hide
  171. DoEvents
  172. End Sub
  173. Private Sub Form_Activate()
  174. DoEvents
  175. StartPrint
  176. End Sub
  177. Private Sub Form_Load()
  178. On Error GoTo ErrTrap
  179. Cancelled = False
  180. CenterForm Me, Screen
  181. Me.Caption = App.title
  182. StatusText.Caption = LoadResString(2010)
  183. cmdCancel.Caption = LoadResString(1003)
  184. ' Set Fonts
  185. SetFonts Me
  186. DoEvents
  187. Exit Sub
  188. ErrTrap:
  189. Exit Sub
  190. End Sub