home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap38 / frmnet~2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-11  |  2.4 KB  |  82 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. Attribute VB_Name = "frmNetInfo"
  50. Attribute VB_Creatable = False
  51. Attribute VB_Exposed = False
  52. Private Sub cmdShowResource_Click()
  53. Dim GetResource As Long
  54. Dim DeviceID As String
  55. Dim ResourceName As String
  56. Dim lngResource As Long
  57. Dim Msg As String
  58. ResourceName = Space(50)
  59. lngResource = Len(ResourceName)
  60. DeviceID = UCase$(txtDevice)
  61. GetResource = WNetGetConnection(DeviceID, ResourceName, lngResource)
  62. Msg = "Device " + DeviceID + vbCrLf + "Connected To: " + ResourceName
  63. MsgBox Msg, , "Network Resource Information"
  64. End Sub
  65. Private Sub cmdShowUser_Click()
  66. Dim GetUser As Long
  67. Dim DeviceID As String
  68. Dim UserName As String
  69. Dim lngName As Long
  70. Dim Msg As String
  71. UserName = Space(25)
  72. lngName = Len(UserName)
  73. DeviceID = UCase$(txtDevice)
  74. GetName = WNetGetUser(DeviceID, UserName, lngName)
  75. Msg = "Device " + DeviceID + vbCrLf + "Is Being Used By " + UserName
  76. MsgBox Msg, , "Network User Information"
  77. End Sub
  78. Private Sub Form_Load()
  79. txtDevice = ""
  80. txtResource = ""
  81. End Sub
  82.