設(shè)為首頁收藏本站Access中國

Office中國論壇/Access中國論壇

 找回密碼
 注冊

QQ登錄

只需一步,快速開始

返回列表 發(fā)新帖
查看: 4198|回復(fù): 4
打印 上一主題 下一主題

[Access本身] 請問要如何 獲取CurrentProject.Path 的 hd.Model

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
1#
發(fā)表于 2010-9-6 09:57:13 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
以下可獲取 所有
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
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 分享淘帖 訂閱訂閱
2#
 樓主| 發(fā)表于 2010-9-6 09:59:57 | 只看該作者
對不起再發(fā)一次
以下可獲取 所有 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

點(diǎn)擊這里給我發(fā)消息

3#
發(fā)表于 2010-9-6 11:08:18 | 只看該作者
hd.Model 應(yīng)該是指 整個(gè)電腦的硬件 相關(guān)信息吧
與currentproject無關(guān)啊

點(diǎn)擊這里給我發(fā)消息

4#
發(fā)表于 2010-9-6 11:10:16 | 只看該作者
這是老朱做的實(shí)例

作 者:朱亦文
摘 要:獲取主板編號(hào)、獲取網(wǎng)上MAC地址、獲取硬盤型號(hào)、獲取IP地址
正 文:


'===============================================
'一組基于 WMI 的函數(shù)
'作者:朱亦文
'時(shí)間:2009.04.27
'===============================================

'獲取主板編號(hào)
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

'獲取網(wǎng)上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

'獲取硬盤型號(hào)
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


5#
 樓主| 發(fā)表于 2010-9-6 11:20:02 | 只看該作者
老大:
謝謝!
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則

QQ|站長郵箱|小黑屋|手機(jī)版|Office中國/Access中國 ( 粵ICP備10043721號(hào)-1 )  

GMT+8, 2024-10-23 08:37 , Processed in 0.190138 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回復(fù) 返回頂部 返回列表