home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / NIVB_SRC / QUEUE.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-06-03  |  6.6 KB  |  198 lines

  1. VERSION 2.00
  2. Begin Form QueueForm 
  3.    Caption         =   "Queue Services Test"
  4.    Height          =   4365
  5.    Left            =   810
  6.    LinkTopic       =   "Form1"
  7.    ScaleHeight     =   3960
  8.    ScaleWidth      =   6000
  9.    Top             =   1185
  10.    Width           =   6120
  11.    Begin Timer RescanTimer 
  12.       Interval        =   1000
  13.       Left            =   4200
  14.       Top             =   3360
  15.    End
  16.    Begin ListBox JobList 
  17.       FontBold        =   -1  'True
  18.       FontItalic      =   0   'False
  19.       FontName        =   "Courier"
  20.       FontSize        =   9.75
  21.       FontStrikethru  =   0   'False
  22.       FontUnderline   =   0   'False
  23.       Height          =   2370
  24.       Left            =   120
  25.       TabIndex        =   5
  26.       Top             =   360
  27.       Width           =   5775
  28.    End
  29.    Begin ComboBox QueueNameBox 
  30.       Height          =   288
  31.       Left            =   1200
  32.       TabIndex        =   3
  33.       Top             =   3600
  34.       Width           =   2412
  35.    End
  36.    Begin ComboBox ServerNameBox 
  37.       Height          =   288
  38.       Left            =   1200
  39.       Sorted          =   -1  'True
  40.       TabIndex        =   1
  41.       Top             =   3240
  42.       Width           =   2412
  43.    End
  44.    Begin CommandButton CloseButton 
  45.       Caption         =   "&OK"
  46.       Height          =   372
  47.       Left            =   4800
  48.       TabIndex        =   0
  49.       Top             =   3360
  50.       Width           =   972
  51.    End
  52.    Begin Label Label6 
  53.       Caption         =   "Active"
  54.       Height          =   252
  55.       Left            =   840
  56.       TabIndex        =   9
  57.       Top             =   120
  58.       Width           =   612
  59.    End
  60.    Begin Label Label5 
  61.       Caption         =   "Size (bytes)"
  62.       Height          =   252
  63.       Left            =   4800
  64.       TabIndex        =   8
  65.       Top             =   120
  66.       Width           =   1092
  67.    End
  68.    Begin Label Label4 
  69.       Caption         =   "Owner [Station #]"
  70.       Height          =   255
  71.       Left            =   1680
  72.       TabIndex        =   7
  73.       Top             =   120
  74.       Width           =   1695
  75.    End
  76.    Begin Label Label3 
  77.       Caption         =   "Job #"
  78.       Height          =   252
  79.       Left            =   120
  80.       TabIndex        =   6
  81.       Top             =   120
  82.       Width           =   732
  83.    End
  84.    Begin Label Label1 
  85.       Alignment       =   1  'Right Justify
  86.       Caption         =   "Queue:"
  87.       Height          =   252
  88.       Left            =   0
  89.       TabIndex        =   4
  90.       Top             =   3600
  91.       Width           =   1092
  92.    End
  93.    Begin Label Label2 
  94.       Alignment       =   1  'Right Justify
  95.       Caption         =   "File Server:"
  96.       Height          =   252
  97.       Left            =   0
  98.       TabIndex        =   2
  99.       Top             =   3240
  100.       Width           =   1092
  101.    End
  102. Sub CheckQueue ()
  103.     Dim queueName As String * 48
  104.     Dim jobInfo As JOB_STRUCT
  105.     Static jobNumbers(250) As Long
  106.     maxJobs& = 250
  107.     JobList.Clear
  108.     queueName = String$(48, 0)
  109.     searchName = QueueNameBox.Text
  110.     ccode% = ScanBinderyObject(searchName, OT_PRINT_QUEUE, queueID&, queueName, oType%, oHasProps%, oFlag%, oSec%)
  111.     ccode% = GetQueueJobList(queueID&, jobCount&, jobNumbers(0), maxJobs&)
  112.     If ((ccode% = SUCCESSFUL) And (jobCount& > 0)) Then
  113.         For job& = 0 To (jobCount& - 1)
  114.             ccode% = ReadQueueJobEntry(queueID&, jobNumbers(job&), jobInfo)
  115.             If (ccode% = SUCCESSFUL) Then
  116.                 clientName$ = String$(48, 0)
  117.                 ccode% = GetBinderyObjectName(jobInfo.clientIDNumber, clientName$, oType%)
  118.                 If (ccode% = SUCCESSFUL) Then
  119.                     ccode% = GetQueueJobsFileSize(queueID&, jobNumbers(job&), fileSize&)
  120.                     If (ccode% = SUCCESSFUL) Then
  121.                         out$ = Format$(jobNumbers(job&), "#########   ")
  122.                         If (jobInfo.serverIDNumber = 0) Then
  123.                             out$ = out$ + "N     "
  124.                         Else
  125.                             out$ = out$ + "Y     "
  126.                         End If
  127.                         clientName$ = Left$(clientName$, InStr(clientName$, Chr$(0)) - 1)
  128.                         out$ = out$ + Left$(clientName$, 20)
  129.                         out$ = out$ + "[" + Format$(jobInfo.clientStation) + "]"
  130.                         out$ = out$ + Space$(39 - Len(out$))
  131.                         out$ = out$ + Format(fileSize&, "############")
  132.                         JobList.AddItem out$
  133.                     End If
  134.                 End If
  135.             End If
  136.         Next job&
  137.     End If
  138. End Sub
  139. Sub CloseButton_Click ()
  140.     Unload QueueForm
  141. End Sub
  142. Sub Form_Load ()
  143.     For connID% = 1 To 8
  144.         'for each connection in workstation's file server name table
  145.         'get the table entry, then see if it's null
  146.         
  147.         fileServerName$ = String$(48, 0)
  148.         If (IsConnectionIDInUse(connID%) = 1) Then
  149.             GetFileServerName connID%, fileServerName$
  150.             ServerNameBox.AddItem fileServerName$
  151.         End If
  152.     Next connID%
  153.     'get name of default file server for combo box
  154.     fileServerName$ = GetDefaultFileServerName()
  155.     ServerNameBox.Text = fileServerName$
  156. End Sub
  157. Sub Form_Unload (Cancel As Integer)
  158.     SetPreferredConnectionID (originalPrefConnID%)
  159. End Sub
  160. Sub QueueNameBox_Change ()
  161.     CheckQueue
  162. End Sub
  163. Sub QueueNameBox_Click ()
  164.     QueueNameBox_Change
  165. End Sub
  166. Sub RescanTimer_Timer ()
  167.     CheckQueue
  168. End Sub
  169. Sub ScanQueues ()
  170.     QueueNameBox.Clear
  171.     oID& = -1
  172.     Do
  173.         queueName$ = String$(48, 0)
  174.         ccode% = ScanBinderyObject("*", OT_PRINT_QUEUE, oID&, queueName$, oType%, oHasProps%, oFlag%, oSec%)
  175.         If (ccode% = SUCCESSFUL) Then
  176.             queueName$ = Left$(queueName$, InStr(queueName$, Chr$(0)) - 1)
  177.             QueueNameBox.AddItem queueName$
  178.         End If
  179.     Loop While (ccode% = SUCCESSFUL)
  180.     If (QueueNameBox.ListCount > 0) Then QueueNameBox.Text = QueueNameBox.List(0)
  181. End Sub
  182. Sub ServerNameBox_Change ()
  183.     ServerNameBox_Click
  184. End Sub
  185. Sub ServerNameBox_Click ()
  186.     prefServer$ = ServerNameBox.Text
  187.     ccode% = GetConnectionID(prefServer$, connID%)
  188.     If (ccode% = SUCCESSFUL) Then
  189.         SetPreferredConnectionID (connID%)  'tell which file server to send
  190.                                             'requests to
  191.         Screen.MousePointer = 11
  192.         ScanQueues                          'then go scan its bindery for queue objects
  193.         Screen.MousePointer = 0
  194.     Else
  195.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  196.     End If
  197. End Sub
  198.