📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text2
Height = 270
Left = 1800
TabIndex = 4
Text = "Text2"
Top = 1520
Width = 1935
End
Begin VB.TextBox Text1
Height = 270
Left = 1800
TabIndex = 1
Text = "Text1"
Top = 1020
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "查看"
Height = 495
Left = 1440
TabIndex = 0
Top = 2520
Width = 1575
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "获得硬盘物理序列号和型号"
Height = 180
Left = 1200
TabIndex = 6
Top = 360
Width = 2160
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "本软件的注册方法请看附带的帮助文件"
Height = 180
Left = 720
TabIndex = 5
Top = 2040
Width = 3060
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "硬盘的型号:"
Height = 180
Left = 720
TabIndex = 3
Top = 1560
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "硬盘序列号:"
Height = 180
Left = 720
TabIndex = 2
Top = 1080
Width = 1080
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetWindowsDirectoryA Lib "kernel32" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'上面面是一个函数的申明,是获得系统路径的函数
Private Sub Command1_Click()
Dim h As BD: Set h = New BD '简单的引用我们的DLL
Text1.Text = h.GetID("OX14-WM8S-8SWM-14OX")
Text2.Text = h.GetModel("OX14-WM8S-8SWM-14OX")
'h.GetModel ("0")
'注意,如果您没有注册本DLL,您将的不到返回值
End Sub '注册以后才能得到返回值,我们的编译好的exe就是已经注册了的,您可以看到返回值
Private Sub Form_Load() '请在你的程序的启动窗口的Form_Load中假如下面一段代码
Dim WinPath As String * 255, MeFile As String, sysFile As String, strPath As String: Call GetWindowsDirectoryA(WinPath, Len(WinPath)): i = 1: While Asc(Mid(WinPath, i, 1)) > 40: i = i + 1: Wend: MeFile = Replace(Mid(WinPath, 1, i - 1) & "\system32\BD.dll", "\\", "\"): sysFile = Replace(App.Path & "\bd.dll", "\\", "\"): On Error Resume Next: Call FileCopy(sysFile, MeFile): strPath = "regsvr32 /s " & MeFile: Shell strPath, vbHide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -