home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / nivb_src / prntserv.frm < prev    next >
Text File  |  1993-06-03  |  2KB  |  88 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. End
  44. Const CR = 13
  45.  
  46. Sub CancelButton_Click ()
  47.     Unload PrintServerForm
  48. End Sub
  49.  
  50. Sub Form_Load ()
  51.     Dim objectType As String * 6
  52.  
  53.     PrintServerList.Clear
  54.  
  55.     oID& = -1   'initialize object ID to -1 for first call to ScanBinderyObject
  56.     Do
  57.         oName$ = String$(48, 0)
  58.         ccode% = ScanBinderyObject("*", OT_PRINT_SERVER, oID&, oName$, oType%, oHasProps%, oFlag%, oSecurity%)
  59.         If (ccode% = SUCCESSFUL) Then
  60.             'take all characters of server name up to terminating null
  61.             out$ = Left$(oName$, InStr(oName$, Chr$(0)) - 1)
  62.             
  63.             PrintServerList.AddItem out$
  64.         End If
  65.     Loop Until ccode%
  66.     If (PrintServerList.ListCount > 0) Then PrintServerList.ListIndex = 0
  67. End Sub
  68.  
  69. Sub OKButton_Click ()
  70.     PrintServerName$ = PrintServerList.List(PrintServerList.ListIndex)
  71.  
  72.     If (Len(PrintServerName$) > 0) Then
  73.         PSInfoForm.Show
  74.     Else
  75.         MsgBox "No print servers available.", MB_OK, "Error"
  76.         Unload PrintServerForm
  77.     End If
  78. End Sub
  79.  
  80. Sub PrintServerList_Click ()
  81.     PrintServerName$ = PrintServerList.List(PrintServerList.ListIndex)
  82. End Sub
  83.  
  84. Sub PrintServerList_DblClick ()
  85.     OKButton_Click
  86. End Sub
  87.  
  88.