home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / queue.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  6.8 KB  |  202 lines

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