home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / NIVB_SRC / PRNTSERV.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-06-03  |  2.4 KB  |  78 lines

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