189 8069 5689

读机器码vbnet 写机器码

VB怎么获取计算机的机器码

'引用api获得硬盘序列号

网站建设哪家好,找成都创新互联公司!专注于网页设计、网站建设、微信开发、微信小程序定制开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了海西免费建站欢迎大家使用!

Private Declare Function MymachineC Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long

Private Sub Form_Load()

Dim AA, 硬盘序列号, Maxlen, Sysflag As Long: Dim VolName, FsysName As String

AA = MymachineC("c:\", VolName, 256, 硬盘序列号, Maxlen, Sysflag, FsysName, 256)

msgbox "C硬盘序列号-机器码啦-(16制): " Hex(硬盘序列号)

End Sub

VB获取电脑机器码

很难达到你的要求的,VB好像是获取不到硬盘的物理序列号的,只能获取到某一个分区的序列号.不过可以调用其它的程序写的获取硬盘物理序列号的dll来获取,CPU的序列号我用的是wmi.VB本来对底层方面就不是很好

引用api获得硬盘序列号

Private Declare Function MymachineC Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long

Private Sub Form_Load()

Dim AA, 硬盘序列号, Maxlen, Sysflag As Long: Dim VolName, FsysName As String

AA = MymachineC("c:\", VolName, 256, 硬盘序列号, Maxlen, Sysflag, FsysName, 256)

msgbox "C硬盘序列号-机器码啦-(16制): " Hex(硬盘序列号)

End Sub

EXCEL中能否用VBA读取电脑的机器码?

电脑没有机器码的,我们所说的机器码指对电脑的配件(如硬盘)型号按一定算法演算出的代码.通常不同软件演算出的机器码都是不一样的,下面三个函数分别得到本机IP,电脑名称,硬盤Id.(硬盤id可做机器码)Public Function GetIPAddress() As String'得到IPSTRComputer = "."

Set OBJWMIService = GetObject("winmgmts:" "{impersonationLevel=impersonate}!\\" STRComputer "\root\cimv2")Set IPConfigSet = OBJWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") For Each IPConfig In IPConfigSet If Not IsNull(IPConfig.IPAddress) Then For i = LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress) GetIPAddress = IPConfig.IPAddress(i) Next End IfNext

End Function

Public Function GetUserName() As String'得到电脑名称STRComputer = "."

Set OBJWMIService = GetObject("winmgmts:\\" STRComputer "\root\CIMV2")Set ColCSItems = OBJWMIService.ExecQuery("SELECT * From Win32_ComputerSystem")For Each OBJCSItem In ColCSItems GetUserName = OBJCSItem.UserNameNext

End Function

Public Function GetDiskID(Disk As String) As String'得到磁盤IDDim Flag As BooleanDim DiskID As String

Flag = FalseOn Error GoTo label

DiskID = Str(CreateObject("Scripting.FileSystemObject").GetDrive(Disk).SerialNumber)

Flag = Truelabel:If Flag Then GetDiskID = DiskIDElse GetDiskID = "" x = MsgBox("Function Parameter Like C " + Chr(10) + Chr(13) + "Please Check The Existence Of The " + Disk + " Disk", vbInformation + vbOKOnly, "Microsoft Excel 5.0")End If

End Function


网站名称:读机器码vbnet 写机器码
文章地址:http://cdxtjz.cn/article/doejgsp.html

其他资讯