home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap38 / frmnet~2.frm < prev    next >
Text File  |  1995-09-11  |  2KB  |  103 lines

  1. VERSION 4.00
  2. Begin VB.Form frmNetInfo 
  3.    Caption         =   "Network Information"
  4.    ClientHeight    =   1560
  5.    ClientLeft      =   3120
  6.    ClientTop       =   2385
  7.    ClientWidth     =   3765
  8.    Height          =   1965
  9.    Left            =   3060
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1560
  12.    ScaleWidth      =   3765
  13.    Top             =   2040
  14.    Width           =   3885
  15.    Begin VB.CommandButton cmdShowResource 
  16.       Caption         =   "Show &Resource"
  17.       Height          =   375
  18.       Left            =   1920
  19.       TabIndex        =   3
  20.       Top             =   960
  21.       Width           =   1455
  22.    End
  23.    Begin VB.TextBox txtDevice 
  24.       Height          =   375
  25.       Left            =   360
  26.       TabIndex        =   0
  27.       Text            =   "txtDevice"
  28.       Top             =   360
  29.       Width           =   3015
  30.    End
  31.    Begin VB.CommandButton cmdShowUser 
  32.       Caption         =   "Show &User"
  33.       Default         =   -1  'True
  34.       Height          =   375
  35.       Left            =   360
  36.       TabIndex        =   1
  37.       Top             =   960
  38.       Width           =   1455
  39.    End
  40.    Begin VB.Label Label1 
  41.       Alignment       =   2  'Center
  42.       Caption         =   "Local Device Identifier"
  43.       Height          =   255
  44.       Left            =   360
  45.       TabIndex        =   2
  46.       Top             =   120
  47.       Width           =   3015
  48.    End
  49. End
  50. Attribute VB_Name = "frmNetInfo"
  51. Attribute VB_Creatable = False
  52. Attribute VB_Exposed = False
  53.  
  54.  
  55.  
  56.  
  57. Private Sub cmdShowResource_Click()
  58. Dim GetResource As Long
  59. Dim DeviceID As String
  60. Dim ResourceName As String
  61. Dim lngResource As Long
  62. Dim Msg As String
  63.  
  64. ResourceName = Space(50)
  65. lngResource = Len(ResourceName)
  66.  
  67. DeviceID = UCase$(txtDevice)
  68.  
  69. GetResource = WNetGetConnection(DeviceID, ResourceName, lngResource)
  70.  
  71. Msg = "Device " + DeviceID + vbCrLf + "Connected To: " + ResourceName
  72. MsgBox Msg, , "Network Resource Information"
  73.  
  74. End Sub
  75.  
  76. Private Sub cmdShowUser_Click()
  77. Dim GetUser As Long
  78. Dim DeviceID As String
  79. Dim UserName As String
  80. Dim lngName As Long
  81. Dim Msg As String
  82.  
  83. UserName = Space(25)
  84. lngName = Len(UserName)
  85.  
  86. DeviceID = UCase$(txtDevice)
  87.  
  88. GetName = WNetGetUser(DeviceID, UserName, lngName)
  89.  
  90. Msg = "Device " + DeviceID + vbCrLf + "Is Being Used By " + UserName
  91. MsgBox Msg, , "Network User Information"
  92.  
  93. End Sub
  94.  
  95. Private Sub Form_Load()
  96. txtDevice = ""
  97. txtResource = ""
  98. End Sub
  99.  
  100.  
  101.  
  102.  
  103.