#### 声明部分 在模块中添加以下声明: ```vb Public Declare Function GetVolumeInformation 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 ```
- **获取本地ID** (`CmdLocalID_Click`) ```vb Private Sub CmdLocalID_Click() Dim Driver, VolName, Fsys As String Dim volNumber, MCM, FSF As Long Driver = "c:\" Dim res As Long res = GetVolumeInformation(Driver, VolName, 127, volNumber, MCM, FSF, Fsys, 127) Localid = volNumber / 2 + 123456789 Text1.Text = Localid End Sub ```
- **生成注册ID** (`CmdRegID_Click`) ```vb Private Sub CmdRegID_Click() If IsNumeric(Text1.Text) Then Regid = CLng(Text1.Text) / 4 * 3 + 987654321 Text2.Text = Regid Else MsgBox "输入无效,请确保输入为数字。" End If End Sub ```
- **验证注册ID** (`CmndCheckID_Click`) ```vb Private Sub CmndCheckID_Click() Dim Driver, VolName, Fsys As String Dim volNumber, MCM, FSF As Long Driver = "c:\" Dim res As Long res = GetVolumeInformation(Driver, VolName, 127, volNumber, MCM, FSF, Fsys, 127) Dim Tid As Long Tid = volNumber / 2 + 123456789 If Regid = Tid / 4 * 3 + 987654321 Then MsgBox "验证成功!" Else MsgBox "验证失败!" End If End Sub ```