home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / nivb_src / queue.frm < prev    next >
Text File  |  1993-06-03  |  7KB  |  215 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. End
  103.  
  104. Sub CheckQueue ()
  105.     Dim queueName As String * 48
  106.     Dim jobInfo As JOB_STRUCT
  107.     Static jobNumbers(250) As Long
  108.     maxJobs& = 250
  109.     
  110.     JobList.Clear
  111.     queueName = String$(48, 0)
  112.     searchName = QueueNameBox.Text
  113.     ccode% = ScanBinderyObject(searchName, OT_PRINT_QUEUE, queueID&, queueName, oType%, oHasProps%, oFlag%, oSec%)
  114.  
  115.     ccode% = GetQueueJobList(queueID&, jobCount&, jobNumbers(0), maxJobs&)
  116.     If ((ccode% = SUCCESSFUL) And (jobCount& > 0)) Then
  117.         For job& = 0 To (jobCount& - 1)
  118.             ccode% = ReadQueueJobEntry(queueID&, jobNumbers(job&), jobInfo)
  119.             If (ccode% = SUCCESSFUL) Then
  120.                 clientName$ = String$(48, 0)
  121.                 ccode% = GetBinderyObjectName(jobInfo.clientIDNumber, clientName$, oType%)
  122.                 If (ccode% = SUCCESSFUL) Then
  123.                     ccode% = GetQueueJobsFileSize(queueID&, jobNumbers(job&), fileSize&)
  124.                     If (ccode% = SUCCESSFUL) Then
  125.                         out$ = Format$(jobNumbers(job&), "#########   ")
  126.                         If (jobInfo.serverIDNumber = 0) Then
  127.                             out$ = out$ + "N     "
  128.                         Else
  129.                             out$ = out$ + "Y     "
  130.                         End If
  131.                         clientName$ = Left$(clientName$, InStr(clientName$, Chr$(0)) - 1)
  132.                         out$ = out$ + Left$(clientName$, 20)
  133.                         out$ = out$ + "[" + Format$(jobInfo.clientStation) + "]"
  134.                         out$ = out$ + Space$(39 - Len(out$))
  135.                         out$ = out$ + Format(fileSize&, "############")
  136.                         JobList.AddItem out$
  137.                     End If
  138.                 End If
  139.             End If
  140.         Next job&
  141.     End If
  142. End Sub
  143.  
  144. Sub CloseButton_Click ()
  145.     Unload QueueForm
  146. End Sub
  147.  
  148. Sub Form_Load ()
  149.     For connID% = 1 To 8
  150.         'for each connection in workstation's file server name table
  151.         'get the table entry, then see if it's null
  152.         
  153.         fileServerName$ = String$(48, 0)
  154.         If (IsConnectionIDInUse(connID%) = 1) Then
  155.             GetFileServerName connID%, fileServerName$
  156.             ServerNameBox.AddItem fileServerName$
  157.         End If
  158.     Next connID%
  159.  
  160.     'get name of default file server for combo box
  161.     fileServerName$ = GetDefaultFileServerName()
  162.     ServerNameBox.Text = fileServerName$
  163. End Sub
  164.  
  165. Sub Form_Unload (Cancel As Integer)
  166.     SetPreferredConnectionID (originalPrefConnID%)
  167. End Sub
  168.  
  169. Sub QueueNameBox_Change ()
  170.     CheckQueue
  171. End Sub
  172.  
  173. Sub QueueNameBox_Click ()
  174.     QueueNameBox_Change
  175. End Sub
  176.  
  177. Sub RescanTimer_Timer ()
  178.     CheckQueue
  179. End Sub
  180.  
  181. Sub ScanQueues ()
  182.     QueueNameBox.Clear
  183.     oID& = -1
  184.     Do
  185.         queueName$ = String$(48, 0)
  186.         ccode% = ScanBinderyObject("*", OT_PRINT_QUEUE, oID&, queueName$, oType%, oHasProps%, oFlag%, oSec%)
  187.         If (ccode% = SUCCESSFUL) Then
  188.             queueName$ = Left$(queueName$, InStr(queueName$, Chr$(0)) - 1)
  189.             QueueNameBox.AddItem queueName$
  190.         End If
  191.     Loop While (ccode% = SUCCESSFUL)
  192.  
  193.     If (QueueNameBox.ListCount > 0) Then QueueNameBox.Text = QueueNameBox.List(0)
  194. End Sub
  195.  
  196. Sub ServerNameBox_Change ()
  197.     ServerNameBox_Click
  198. End Sub
  199.  
  200. Sub ServerNameBox_Click ()
  201.     prefServer$ = ServerNameBox.Text
  202.     
  203.     ccode% = GetConnectionID(prefServer$, connID%)
  204.     If (ccode% = SUCCESSFUL) Then
  205.         SetPreferredConnectionID (connID%)  'tell which file server to send
  206.                                             'requests to
  207.         Screen.MousePointer = 11
  208.         ScanQueues                          'then go scan its bindery for queue objects
  209.         Screen.MousePointer = 0
  210.     Else
  211.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  212.     End If
  213. End Sub
  214.  
  215.