得到本计算机的一些信息


Public   Class Bq_Pc   '得到本计算机的一些信息
    Private lPcIP, lName, lPcName As String
    
Private lTemp, lSys32, lDesk, lWindir, lTemplates As String
    
Private lFavorites, lProgramFiles As String

    
Public Sub New()
        
Try
            
Dim oEnv As System.Environment
            
Dim oSpe As Environment.SpecialFolder
            
Dim myip As System.Net.IPHostEntry
            
Dim lBqfn As New bqbass.BqFnBass

            myip 
= System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)
            lName 
= System.Environment.UserName            '当前用户名
            If Len(lName) = 0 Then
                lName 
= System.Environment.UserDomainName   '当前用户名 
            End If
            lPcIP 
= myip.AddressList.GetValue(0).ToString
            lPcName 
= System.Environment.MachineName        '当前机器名 
            Dim s As String
            s 
= System.Environment.OSVersion.ToString
            lPcName 
= myip.HostName.ToString
            lTemp 
= lBqfn.BqPathG(System.IO.Path.GetTempPath())
            lDesk 
= lBqfn.BqPathG(oEnv.GetFolderPath(oSpe.DesktopDirectory))
            lSys32 
= lBqfn.BqPathG(oEnv.GetFolderPath(oSpe.System))
            lWindir 
= lBqfn.BqPathG(oEnv.GetFolderPath(oSpe.MyComputer))   '????

            lTemplates 
= lBqfn.BqPathG(oEnv.GetFolderPath(oSpe.Templates))
            lProgramFiles 
= lBqfn.BqPathG(oEnv.GetFolderPath(oSpe.ProgramFiles))
            lFavorites 
= lBqfn.BqPathG(oEnv.GetFolderPath(oSpe.Favorites))


            
Dim k As String = System.Environment.SystemDirectory
            Debug.WriteLine(k)

        
Catch ex As Exception
        
End Try

        
'还要得到cpu的号,硬盘的号等
    End Sub

    
Public ReadOnly Property sPcName() As String        '当前机器名 
        Get
            
Return lPcName
        
End Get
    
End Property
   '当前机器名 
    Public ReadOnly Property sPcIP() As String        '主机IP
        Get
            
Return lPcIP
        
End Get
    
End Property
     '主机IP
    Public ReadOnly Property sUserName() As String      '当前用户名 
        Get
            
Return lName
        
End Get
    
End Property
 '当前用户名 
    Public ReadOnly Property sSysPathTemp() As String
        
Get
            
Return lTemp
        
End Get
    
End Property

    
Public ReadOnly Property sSysPathSys32() As String
        
Get
            
Return lSys32
        
End Get
    
End Property

    
Public ReadOnly Property sSysPathDesk() As String
        
Get
            
Return lDesk
        
End Get
    
End Property

    
Public ReadOnly Property sSysPathWindir() As String
        
Get
            
Return lWindir
        
End Get
    
End Property

    
Public ReadOnly Property sSysPathTemplates() As String
        
Get
            
Return lTemplates
        
End Get
    
End Property

    
Public ReadOnly Property sSysPathFavorites() As String
        
Get
            
Return lFavorites
        
End Get
    
End Property

    
Public ReadOnly Property sSysPathProgramFiles() As String
        
Get
            
Return lProgramFiles
        
End Get
    
End Property

End Class
  ' 得到本计算机的一些信息
 
发布了24 篇原创文章 · 获赞 5 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/cdbqss1/article/details/1903450