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

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