Office中国论坛/Access中国论坛

标题: 请问要如何 获取CurrentProject.Path 的 hd.Model [打印本页]

作者: c101    时间: 2010-9-6 09:57
标题: 请问要如何 获取CurrentProject.Path 的 hd.Model
以下可获取 所有
HD Model

Dim hds As Object, hd As Object

Set hds = GetObject("Winmgmts:").InstancesOf("Win32_DiskDrive")

For Each hd In hds


HDModel = HDModel & IIf(HDModel <> "", ";", "") & hd.Model
请问要如何 获取CurrentProject.Path
hd.Model

作者: c101    时间: 2010-9-6 09:59
對不起再發一次
以下可获取 所有 HD Model  
  Dim hds As Object, hd As Object
  Set hds = GetObject("Winmgmts:").InstancesOf("Win32_DiskDrive")
  For Each hd In hds
        HDModel = HDModel & IIf(HDModel <> "", ";", "") & hd.Model   
  Next

请问要如何 获取 CurrentProject.Path 的 hd.Model

作者: tmtony    时间: 2010-9-6 11:08
hd.Model 应该是指 整个电脑的硬件 相关信息吧
与currentproject无关啊
作者: tmtony    时间: 2010-9-6 11:10
这是老朱做的实例

作 者:朱亦文
摘 要:获取主板编号、获取网上MAC地址、获取硬盘型号、获取IP地址
正 文:


'===============================================
'一组基于 WMI 的函数
'作者:朱亦文
'时间:2009.04.27
'===============================================

'获取主板编号
Public Function MainBoardSN() As String
    Dim objs As Object, Obj As Object
   
    Set objs = GetObject("WinMgmts:").InstancesOf("Win32_BaseBoard")
    For Each Obj In objs
        MainBoardSN = MainBoardSN & IIf(MainBoardSN <> "", ";", "") & Obj.SerialNumber
    Next
End Function

'获取网上MAC地址
Public Function NicMAC() As String
    Dim Nics As Object, oIP As Object
   
    Set Nics = GetObject("Winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
    For Each oIP In Nics
        If oIP.IPEnabled = True Then
            NicMAC = NicMAC & IIf(NicMAC <> "", ";", "") & oIP.MacAddress
            Exit For
        End If
    Next
End Function

'获取硬盘型号
Public Function HDModel() As String
    Dim hds As Object, hd As Object
   
    Set hds = GetObject("Winmgmts:").InstancesOf("Win32_DiskDrive")
    For Each hd In hds
        HDModel = HDModel & IIf(HDModel <> "", ";", "") & hd.Model
    Next
End Function

'获取IP地址
Public Function IP() As String
    Dim OpSysSet, OpSys, oIP
   
    Set OpSysSet = GetObject("winmgmts:{impersonationLevel=impersonate}//localhost"). _
        ExecQuery("Select index, IPAddress FROM Win32_NetworkAdapterConfiguration")
    For Each OpSys In OpSysSet
        If TypeName(OpSys.IPAddress) <> "Null" Then
            For Each oIP In OpSys.IPAddress
                IP = IP & IIf(IP <> "", ";", "") & oIP
            Next
        End If
    Next
End Function



作者: c101    时间: 2010-9-6 11:20
老大:
谢谢!





欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3