home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / nivb_src / psinfo.frm < prev    next >
Text File  |  1993-06-03  |  5KB  |  171 lines

  1. VERSION 2.00
  2. Begin Form PSInfoForm 
  3.    Caption         =   "Print Server Information"
  4.    Height          =   4305
  5.    Left            =   1605
  6.    LinkTopic       =   "Form2"
  7.    ScaleHeight     =   3900
  8.    ScaleWidth      =   6495
  9.    Top             =   1200
  10.    Width           =   6615
  11.    Begin ListBox ServerList 
  12.       Height          =   1005
  13.       Left            =   1680
  14.       TabIndex        =   7
  15.       Top             =   2160
  16.       Width           =   4695
  17.    End
  18.    Begin CommandButton OKButton 
  19.       Caption         =   "&OK"
  20.       Height          =   375
  21.       Left            =   2760
  22.       TabIndex        =   0
  23.       Top             =   3360
  24.       Width           =   975
  25.    End
  26.    Begin Label PSType 
  27.       Height          =   255
  28.       Left            =   2520
  29.       TabIndex        =   11
  30.       Top             =   1440
  31.       Width           =   2775
  32.    End
  33.    Begin Label PSVersion 
  34.       Height          =   255
  35.       Left            =   2520
  36.       TabIndex        =   10
  37.       Top             =   1200
  38.       Width           =   1455
  39.    End
  40.    Begin Label PSPrinters 
  41.       Height          =   255
  42.       Left            =   2520
  43.       TabIndex        =   9
  44.       Top             =   960
  45.       Width           =   1455
  46.    End
  47.    Begin Label PSStatus 
  48.       Height          =   255
  49.       Left            =   2520
  50.       TabIndex        =   8
  51.       Top             =   720
  52.       Width           =   3015
  53.    End
  54.    Begin Label Label5 
  55.       Alignment       =   1  'Right Justify
  56.       Caption         =   "Attached servers:"
  57.       Height          =   255
  58.       Left            =   720
  59.       TabIndex        =   6
  60.       Top             =   1800
  61.       Width           =   1575
  62.    End
  63.    Begin Label Label4 
  64.       Alignment       =   1  'Right Justify
  65.       Caption         =   "Server type:"
  66.       Height          =   255
  67.       Left            =   960
  68.       TabIndex        =   5
  69.       Top             =   1440
  70.       Width           =   1335
  71.    End
  72.    Begin Label Label3 
  73.       Alignment       =   1  'Right Justify
  74.       Caption         =   "Version:"
  75.       Height          =   255
  76.       Left            =   960
  77.       TabIndex        =   4
  78.       Top             =   1200
  79.       Width           =   1335
  80.    End
  81.    Begin Label Label2 
  82.       Alignment       =   1  'Right Justify
  83.       Caption         =   "Attached printers:"
  84.       Height          =   255
  85.       Left            =   720
  86.       TabIndex        =   3
  87.       Top             =   960
  88.       Width           =   1575
  89.    End
  90.    Begin Label Label1 
  91.       Alignment       =   1  'Right Justify
  92.       Caption         =   "Status:"
  93.       Height          =   255
  94.       Left            =   1200
  95.       TabIndex        =   2
  96.       Top             =   720
  97.       Width           =   1095
  98.    End
  99.    Begin Label Title 
  100.       Height          =   495
  101.       Left            =   480
  102.       TabIndex        =   1
  103.       Top             =   240
  104.       Width           =   5535
  105.    End
  106. End
  107.  
  108. Sub Form_Load ()
  109.     Dim info As PS_INFO
  110.  
  111.     Title.Caption = "Information on print server :  " + PrintServerName$ + " :"
  112.     ServerList.Clear
  113.     
  114.     ccode% = PSAttachToPrintServer(PrintServerName$, connID%)
  115.     If (ccode% <> SUCCESSFUL) Then
  116.         PSStatus.Caption = "Unable to attach to print server"
  117.     Else
  118.         ccode% = PSGetPrintServerInfo(connID%, info, Len(info))
  119.         If (ccode% <> SUCCESSFUL) Then
  120.             MsgBox "Unable to get print server information", MB_OK, "Error"
  121.         Else
  122.             Select Case Asc(info.status)
  123.                 Case RUNNING
  124.                     PSStatus.Caption = "Running"
  125.                 Case GOING_DOWN
  126.                     PSStatus.Caption = "Going down"
  127.                 Case DOWN
  128.                     PSStatus.Caption = "Down"
  129.                 Case INITIALIZING
  130.                     PSStatus.Caption = "Initializing"
  131.                 Case Else
  132.                     PSStatus.Caption = "Unknown"
  133.             End Select
  134.  
  135.             PSPrinters.Caption = Asc(info.numPrinters)
  136.             PSVersion.Caption = Format$(Asc(info.majorVersion)) + "." + Format$(Asc(info.minorVersion)) + Chr$(Asc(info.revision) + 97)
  137.             
  138.             Select Case Asc(info.serverType)
  139.                 Case 1
  140.                     PSType.Caption = "Dedicated DOS"
  141.                 Case 2
  142.                     PSType.Caption = "NLM"
  143.                 Case 3
  144.                     PSType.Caption = "File Server VAP"
  145.                 Case 4
  146.                     PSType.Caption = "Bridge VAP"
  147.                 Case Else
  148.                     PSType.Caption = "Unknown"
  149.             End Select
  150.  
  151.             sequence% = 0
  152.             Do
  153.                 serverName$ = String$(48, 0)
  154.                 ccode% = PSGetAttachedServers(connID%, sequence%, serverName$)
  155.                 ServerList.AddItem serverName$
  156.             Loop While (ccode% = SUCCESSFUL)
  157.         End If
  158.         
  159.         ccode% = PSDetachFromPrintServer(connID%)
  160.     End If
  161. End Sub
  162.  
  163. Sub OKButton_Click ()
  164.     Unload PSInfoForm
  165. End Sub
  166.  
  167. Sub PSInfoForm_Click ()
  168.     Unload PSInfoForm
  169. End Sub
  170.  
  171.