请问为什么我公司的vb.net源码到了我的电脑上运行就会显示好多未声明?。?/h2>用API 函数GetVolumeInformation得到的不是硬盘的序列号?。。?
BOOL GetVolumeInformation(
LPCTSTR lpRootPathName,
LPTSTR lpVolumeNameBuffer,
DWORD nVolumeNameSize,
LPDWORD lpVolumeSerialNumber,
LPDWORD lpMaximumComponentLength,
LPDWORD lpFileSystemFlags,
LPTSTR lpFileSystemNameBuffer,
DWORD nFileSystemNameSize
);
看看英文?。篤olumeSerialNumber!得到的只是卷区序列号!
硬盘的序列号应该是
Drive Model Number________________: WDC WD400EB-00CPF0
Drive Serial Number_______________: WD-WCAATF083586
Drive Controller Revision Number__: 06.04G06
Controller Buffer Size on Drive___: 2097152 bytes
Drive Type________________________: Fixed
Drive Size________________________: 40020664320 bytes
中:
Drive Serial Number_______________: WD-WCAATF083586 这才是硬盘Serial Number?。。。?
这个号是不会因为你格式化硬盘而改动,也不是网上流传的修改工具能改的,(其实网上流传的修改工具的也不过是卷区号而已?。?
建议用 DiskID.dll或DiskID32.dll来获取
用diskid.dll和disk32.dll获得硬盘序列号
1.调用diskid.dll实现:
Option Explicit
Private Declare Function IsWinNT Lib "DiskID.DLL" () As Long
Private Declare Function ReadPhysicalDrive9X Lib "DiskID.DLL" (driveID As Long, buffer As Long, bufLen As Long) As Long
Private Declare Function ReadPhysicalDriveInNT Lib "DiskID.DLL" (driveID As Long, buffer As Long, bufLen As Long) As Long
Private Type DRIVER_INFO_OK
ModalNumber(39) As Byte
SerialNumber(19) As Byte
ControlNum(7) As Byte
DriveType As Long
Cylinders As Long
Heads As Long
Sectors As Long
End Type
Private Sub Command1_Click()
Dim x As DRIVER_INFO_OK
Dim i As Long
If IsWinNT = 1 Then
i = ReadPhysicalDriveInNT(ByVal 0, ByVal VarPtr(x), ByVal 256)
Else
i = ReadPhysicalDrive9X(ByVal 0, ByVal VarPtr(x), ByVal 256)
End If
Dim s As String
s = StrConv(x.ModalNumber, vbUnicode)
s = Left(s, InStr(1, s, Chr(0)) - 1)
MsgBox "硬件厂商代码为:" + s
s = StrConv(x.SerialNumber, vbUnicode)
s = Left(s, InStr(1, s, Chr(0)) - 1)
MsgBox "硬盘序列号为:" + s
End Sub
2.调用diskid32.dll实现:
Option Explicit
Private Declare Function DiskID32 Lib "DiskID32.DLL" (ByRef DiskModel As Byte, ByRef DiskID As Byte) As Long
Private Sub Command1_Click()
Dim DiskModel(31) As Byte, DiskID(31) As Byte, i As Integer, Model As String, ID As String
If DiskID32(DiskModel(0), DiskID(0))1 Then
MsgBox "get diskid32 err"
Exit Sub
End If
For i = 0 To 31
If Chr(DiskModel(i))Chr(0) Then
Model = ModelChr(DiskModel(i))
End If
If Chr(DiskID(i))Chr(0) Then
ID = IDChr(DiskID(i))
End If
Next
MsgBox "硬件产生代码为:" + Model
MsgBox "硬盘序列号为:" + ID
End Sub
说明:diskid.dll可从下载
diskid32.dll可从下载
vb.net系统弹窗怎么弄出感叹号?Msgbox的第二个参数是控制弹窗的样式 , 感叹号是MsgBoxStyle.Exclamation和MsgboxStyle.Information,问号是MsgboxStyle.Question
C# 如何使用 VB.net 中的Not?C#.NET和VB.NET是同一托管平台(framework)下的两种不同语言,当然语法会存在差异 。所以C#中无法写出以上代码,只能如此:
ButView.Check = false;
【vb.net中的叹号 vb中感叹号是什么意思】vb.net中的叹号的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb中感叹号是什么意思、vb.net中的叹号的信息别忘了在本站进行查找喔 。
推荐阅读
- 网络游戏公司怎么销售游戏,游戏公司如何
- 小米手机消息弹窗怎么取消,小米手机消息弹窗怎么取消不了
- linux硬件查询命令,linux系统查看硬件信息
- 微信直播为啥创建失败了,微信直播问题
- vb.net的方法 vbnet using
- 江津企业线上推广如何引流,企业线上推广的渠道和方法
- 关于linux命令文档下载的信息
- 安卓带剧情的赛车游戏下载,有剧情的赛车游戏单机
- java组件文本框代码 java gui文本框