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

  1. VERSION 2.00
  2. Begin Form BindForm 
  3.    Caption         =   "Bindery Services Test"
  4.    Height          =   4560
  5.    Left            =   930
  6.    LinkMode        =   1  'Source
  7.    LinkTopic       =   "Form1"
  8.    ScaleHeight     =   4155
  9.    ScaleWidth      =   8895
  10.    Top             =   975
  11.    Width           =   9015
  12.    Begin CommandButton CloseButton 
  13.       Caption         =   "&OK"
  14.       Height          =   372
  15.       Left            =   6720
  16.       TabIndex        =   11
  17.       Top             =   3600
  18.       Width           =   1332
  19.    End
  20.    Begin ComboBox ServerNameBox 
  21.       Height          =   288
  22.       Left            =   2400
  23.       Sorted          =   -1  'True
  24.       TabIndex        =   0
  25.       Text            =   "ServerNameBox"
  26.       Top             =   3600
  27.       Width           =   2412
  28.    End
  29.    Begin ListBox BinderyObjList 
  30.       FontBold        =   -1  'True
  31.       FontItalic      =   0   'False
  32.       FontName        =   "Courier"
  33.       FontSize        =   9.75
  34.       FontStrikethru  =   0   'False
  35.       FontUnderline   =   0   'False
  36.       Height          =   2370
  37.       Left            =   240
  38.       Sorted          =   -1  'True
  39.       TabIndex        =   9
  40.       Top             =   840
  41.       Width           =   8460
  42.    End
  43.    Begin Label Label10 
  44.       Caption         =   "File Server:"
  45.       Height          =   252
  46.       Left            =   1200
  47.       TabIndex        =   10
  48.       Top             =   3600
  49.       Width           =   1092
  50.    End
  51.    Begin Label Label1 
  52.       Caption         =   "Add Props"
  53.       Height          =   252
  54.       Left            =   7560
  55.       TabIndex        =   8
  56.       Top             =   480
  57.       Width           =   972
  58.    End
  59.    Begin Label Label7 
  60.       Caption         =   "Scan"
  61.       Height          =   252
  62.       Left            =   7080
  63.       TabIndex        =   7
  64.       Top             =   480
  65.       Width           =   492
  66.    End
  67.    Begin Label Label9 
  68.       BorderStyle     =   1  'Fixed Single
  69.       Height          =   12
  70.       Left            =   7080
  71.       TabIndex        =   12
  72.       Top             =   360
  73.       Width           =   1452
  74.    End
  75.    Begin Label Label4 
  76.       Caption         =   "Object ID"
  77.       Height          =   252
  78.       Left            =   4920
  79.       TabIndex        =   6
  80.       Top             =   360
  81.       Width           =   852
  82.    End
  83.    Begin Label Label3 
  84.       Caption         =   "Object Type"
  85.       Height          =   252
  86.       Left            =   3120
  87.       TabIndex        =   5
  88.       Top             =   360
  89.       Width           =   1092
  90.    End
  91.    Begin Label Label2 
  92.       Caption         =   "Object Name"
  93.       Height          =   252
  94.       Left            =   312
  95.       TabIndex        =   4
  96.       Top             =   372
  97.       Width           =   1212
  98.    End
  99.    Begin Label Label6 
  100.       Alignment       =   2  'Center
  101.       Caption         =   "Dyn/ Stat"
  102.       Height          =   372
  103.       Left            =   6384
  104.       TabIndex        =   3
  105.       Top             =   252
  106.       Width           =   612
  107.    End
  108.    Begin Label Label5 
  109.       Alignment       =   2  'Center
  110.       Caption         =   "Has Props"
  111.       Height          =   372
  112.       Left            =   5880
  113.       TabIndex        =   2
  114.       Top             =   240
  115.       Width           =   612
  116.    End
  117.    Begin Label Label8 
  118.       Caption         =   "Access Control"
  119.       Height          =   252
  120.       Left            =   7140
  121.       TabIndex        =   1
  122.       Top             =   84
  123.       Width           =   1332
  124.    End
  125. End
  126.  
  127. Sub CloseButton_Click ()
  128.     Unload BindForm
  129. End Sub
  130.  
  131. Sub Form_Load ()
  132.     For connID% = 1 To 8
  133.         fileServerName$ = String$(48, 0)
  134.         If (IsConnectionIDInUse(connID%) = 1) Then
  135.             GetFileServerName connID%, fileServerName$
  136.             ServerNameBox.AddItem fileServerName$
  137.         End If
  138.     Next connID%
  139.  
  140.     'get name of default file server for combo box
  141.     fileServerName$ = GetDefaultFileServerName()
  142.     ServerNameBox.Text = fileServerName$
  143.  
  144.     Main.MousePointer = 0
  145. End Sub
  146.  
  147. Sub Form_Unload (Cancel As Integer)
  148.     SetPreferredConnectionID (originalPrefConnID%)
  149. End Sub
  150.  
  151. Sub ScanBindery ()
  152.     Dim objectType As String * 6
  153.  
  154.     BinderyObjList.Clear
  155.  
  156.     oID& = -1   'initialize object ID to -1 for first call to ScanBinderyObject
  157.     Do
  158.         oName$ = String$(48, 0)
  159.         ccode% = ScanBinderyObject("*", OT_WILD, oID&, oName$, oType%, oHasProps%, oFlag%, oSecurity%)
  160.         If (ccode% = SUCCESSFUL) Then
  161.             
  162.             'take all characters of object name up to terminating null
  163.             out$ = Left$(oName$, InStr(oName$, Chr$(0)) - 1)
  164.  
  165.             'then take first 20 chars
  166.             out$ = Left$(out$, 20)
  167.  
  168.             'pad with spaces
  169.             out$ = out$ + Space$(22 - Len(out$))
  170.             
  171.             Select Case oType%
  172.                 Case OT_USER
  173.                     out$ = out$ + "User            "
  174.                 Case OT_USER_GROUP
  175.                     out$ = out$ + "User Group      "
  176.                 Case OT_PRINT_QUEUE
  177.                     out$ = out$ + "Print Queue     "
  178.                 Case OT_FILE_SERVER
  179.                     out$ = out$ + "File Server     "
  180.                 Case OT_JOB_SERVER
  181.                     out$ = out$ + "Job Server      "
  182.                 Case OT_GATEWAY
  183.                     out$ = out$ + "Gateway         "
  184.                 Case OT_PRINT_SERVER
  185.                     out$ = out$ + "Print Server    "
  186.                 Case OT_ARCHIVE_QUEUE
  187.                     out$ = out$ + "Archive Queue   "
  188.                 Case OT_ARCHIVE_SERVER
  189.                     out$ = out$ + "Archive Server  "
  190.                 Case OT_JOB_QUEUE
  191.                     out$ = out$ + "Job Queue       "
  192.                 Case OT_ADMINISTRATION
  193.                     out$ = out$ + "Administration  "
  194.                 Case OT_NAS_SNA_GATEWAY
  195.                     out$ = out$ + "NAS SNA Gateway "
  196.                 Case OT_NACS
  197.                     out$ = out$ + "NACS            "
  198.                 Case OT_REMOTE_BRIDGE_SERVER
  199.                     out$ = out$ + "Rem Bridge Serv "
  200.                 Case OT_BRIDGE_SERVER
  201.                     out$ = out$ + "Bridge Server   "
  202.                 Case OT_TCPIP_GATEWAY
  203.                     out$ = out$ + "TCP/IP Gateway  "
  204.                 Case OT_GATE
  205.                     out$ = out$ + "Gateway         "
  206.                 Case OT_TIME_SYNCHRONIZATION_SERVER
  207.                     out$ = out$ + "Time Synch Serv "
  208.                 Case OT_ARCHIVE_SRV
  209.                     out$ = out$ + "Archive Server  "
  210.                 Case OT_ADVERTISING_PRINT_SERVER
  211.                     out$ = out$ + "Adver Print Srv "
  212.                 Case OT_BTRIEVE_VAP_NLM_5XX
  213.                     out$ = out$ + "Btrieve v5.xx   "
  214.                 Case OT_SQL_VAP_NLM
  215.                     out$ = out$ + "SQL VAP/NLM     "
  216.                 Case OT_XTREE_NETWORK
  217.                     out$ = out$ + "Xtree Net Ver   "
  218.                 Case OT_BTRIEVE_VAP_NLM_4XX
  219.                     out$ = out$ + "Btrieve v4.xx   "
  220.                 Case OT_APPLETALK_GATEWAY
  221.                     out$ = out$ + "AppleTalk Gatew "
  222.                 Case OT_X25_GATEWAY
  223.                     out$ = out$ + "X.25 Gateway    "
  224.                 Case OT_WAN_COPY
  225.                     out$ = out$ + "WAN Copy        "
  226.                 Case OT_TES_NETWARE_VMS
  227.                     out$ = out$ + "TES-NetWare VMS "
  228.                 Case OT_NETWARE_ACCESS_SERVER
  229.                     out$ = out$ + "NW Access Serv  "
  230.                 Case OT_PORTABLE_NETWARE
  231.                     out$ = out$ + "Portable NetW   "
  232.                 Case OT_COMPAQ_IDA_STATUS_MONITOR
  233.                     out$ = out$ + "Compaq IDA Stat "
  234.                 Case OT_NETWARE_386_SERVER
  235.                     out$ = out$ + "NetWare 386 Srv "
  236.                 Case OT_CSA_MUX
  237.                     out$ = out$ + "CSA MUX         "
  238.                 Case OT_CSA_LCA
  239.                     out$ = out$ + "CSA LCA         "
  240.                 Case OT_CSA_CM
  241.                     out$ = out$ + "CSA CM          "
  242.                 Case OT_CSA_SMA
  243.                     out$ = out$ + "CSA SMA         "
  244.                 Case OT_CSA_DBA
  245.                     out$ = out$ + "CSA DBA         "
  246.                 Case OT_CSA_NMA
  247.                     out$ = out$ + "CSA NMA         "
  248.                 Case OT_CSA_SSA
  249.                     out$ = out$ + "CSA SSA         "
  250.                 Case OT_CSA_STATUS
  251.                     out$ = out$ + "CSA STATUS      "
  252.                 Case OT_CSA_APPC
  253.                     out$ = out$ + "CSA APPC        "
  254.                 Case OT_SNA_TEST
  255.                     out$ = out$ + "SNA TEST        "
  256.                 Case OT_CSA_TRACE
  257.                     out$ = out$ + "CSA TRACE       "
  258.                 Case OT_COMMUNICATIONS_EXECUTIVE
  259.                     out$ = out$ + "Comm Executive  "
  260.                 Case OT_NNS_DOMAIN
  261.                     out$ = out$ + "NNS Domain      "
  262.                 Case OT_NNS_PROFILE
  263.                     out$ = out$ + "NNS Profile     "
  264.                 Case OT_NNS_QUEUE
  265.                     out$ = out$ + "NNS Queue       "
  266.                 Case OT_WORDPERFECT_NETWORK
  267.                     out$ = out$ + "WordPerfect Net "
  268.                 Case Else
  269.                     objectType = Str$(oType%)
  270.                     out$ = out$ + "[" + objectType + "]" + "        "
  271.             End Select
  272.  
  273.             'format the bindery object ID as 8 hex digits, with leading zeros
  274.             out$ = out$ + String$((8 - Len(Hex$(oID&))), "0") + Hex$(oID&) + "  "
  275.  
  276.             'does the bindery object have properties?
  277.             If oHasProps% = 0 Then
  278.                 out$ = out$ + "N   "
  279.             Else
  280.                 out$ = out$ + "Y   "
  281.             End If
  282.  
  283.             'is the bindery object static or dynamic?
  284.             If oFlag% = 0 Then
  285.                 out$ = out$ + "Stat  "
  286.             Else
  287.                 out$ = out$ + "Dyn   "
  288.             End If
  289.  
  290.             'who can scan for the bindery object,
  291.             'and who can add properties?
  292.             Select Case (oSecurity% And &HF)
  293.                 Case &H0
  294.                     out$ = out$ + "Any  "   'anyone can scan for the object
  295.                 Case &H1
  296.                     out$ = out$ + "Log  "   'any logged user can scan
  297.                 Case &H2
  298.                     out$ = out$ + "Obj  "   'only the object can scan for itself
  299.                 Case &H3
  300.                     out$ = out$ + "Sup  "   'only the supervisor can scan
  301.                 Case &H4
  302.                     out$ = out$ + "OS   "   'only the operating system can scan
  303.             End Select
  304.             
  305.             Select Case (oSecurity% And &HF0)
  306.                 Case &H0
  307.                     out$ = out$ + "Any  "   'anyone can add properties to the object
  308.                 Case &H10
  309.                     out$ = out$ + "Log  "   'any logged user can add properties
  310.                 Case &H20
  311.                     out$ = out$ + "Obj  "   'only the object can add props to itself
  312.                 Case &H30
  313.                     out$ = out$ + "Sup  "   'only the supervisor can add props
  314.                 Case &H40
  315.                     out$ = out$ + "OS   "   'only the OS can add properties
  316.             End Select
  317.             
  318.             'finally, add one more entry to the list
  319.             'of bindery objects
  320.             BinderyObjList.AddItem out$
  321.         End If
  322.     Loop Until ccode%
  323. End Sub
  324.  
  325. Sub ServerNameBox_Change ()
  326.     prefServer$ = ServerNameBox.Text
  327.     
  328.     ccode% = GetConnectionID(prefServer$, connID%)
  329.     If (ccode% = SUCCESSFUL) Then
  330.         SetPreferredConnectionID (connID%)  'tell which file server to send
  331.                                             'requests to
  332.         Screen.MousePointer = 11
  333.         ScanBindery                         'then go scan its bindery
  334.         Screen.MousePointer = 0
  335.     Else
  336.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  337.     End If
  338. End Sub
  339.  
  340. Sub ServerNameBox_Click ()
  341.     ServerNameBox_Change
  342. End Sub
  343.  
  344.