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

  1. VERSION 2.00
  2. Begin Form PrintServerForm 
  3.    Caption         =   "Print Server Services Test"
  4.    ClientHeight    =   2715
  5.    ClientLeft      =   1455
  6.    ClientTop       =   1545
  7.    ClientWidth     =   5265
  8.    Height          =   3120
  9.    Left            =   1395
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   2715
  12.    ScaleWidth      =   5265
  13.    Top             =   1200
  14.    Width           =   5385
  15.    Begin CommandButton CancelButton 
  16.       Caption         =   "&Cancel"
  17.       Height          =   375
  18.       Left            =   2880
  19.       TabIndex        =   2
  20.       Top             =   2160
  21.       Width           =   855
  22.    End
  23.    Begin CommandButton OKButton 
  24.       Caption         =   "&OK"
  25.       Default         =   -1  'True
  26.       Height          =   375
  27.       Left            =   1680
  28.       TabIndex        =   1
  29.       Top             =   2160
  30.       Width           =   855
  31.    End
  32.    Begin ListBox PrintServerList 
  33.       Height          =   1590
  34.       Left            =   720
  35.       TabIndex        =   0
  36.       Top             =   480
  37.       Width           =   4215
  38.    End
  39.    Begin Label Label1 
  40.       Caption         =   "Select a print server:"
  41.       Height          =   255
  42.       Left            =   240
  43.       TabIndex        =   3
  44.       Top             =   120
  45.       Width           =   2175
  46.    End
  47. Const CR = 13
  48. Sub CancelButton_Click ()
  49.     Unload PrintServerForm
  50. End Sub
  51. Sub Form_Load ()
  52.     Dim objectType As String * 6
  53.     PrintServerList.Clear
  54.     oID& = -1   'initialize object ID to -1 for first call to ScanBinderyObject
  55.     Do
  56.         oName$ = String$(48, 0)
  57.         ccode% = ScanBinderyObject("*", OT_PRINT_SERVER, oID&, oName$, oType%, oHasProps%, oFlag%, oSecurity%)
  58.         If (ccode% = SUCCESSFUL) Then
  59.             'take all characters of server name up to terminating null
  60.             out$ = Left$(oName$, InStr(oName$, Chr$(0)) - 1)
  61.             
  62.             PrintServerList.AddItem out$
  63.         End If
  64.     Loop Until ccode%
  65.     If (PrintServerList.ListCount > 0) Then PrintServerList.ListIndex = 0
  66. End Sub
  67. Sub OKButton_Click ()
  68.     PrintServerName$ = PrintServerList.List(PrintServerList.ListIndex)
  69.     If (Len(PrintServerName$) > 0) Then
  70.         PSInfoForm.Show
  71.     Else
  72.         MsgBox "No print servers available.", MB_OK, "Error"
  73.         Unload PrintServerForm
  74.     End If
  75. End Sub
  76. Sub PrintServerList_Click ()
  77.     PrintServerName$ = PrintServerList.List(PrintServerList.ListIndex)
  78. End Sub
  79. Sub PrintServerList_DblClick ()
  80.     OKButton_Click
  81. End Sub
  82.