⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmserial.frm

📁 vb一个通过硬件信息生成序列号的源码示例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSerial 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   5160
   ClientLeft      =   45
   ClientTop       =   45
   ClientWidth     =   5835
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5160
   ScaleWidth      =   5835
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Height          =   1215
      Left            =   240
      TabIndex        =   5
      Top             =   2040
      Width           =   5295
      Begin VB.CommandButton Command1 
         Caption         =   "单击产生注册码"
         Height          =   375
         Left            =   720
         TabIndex        =   8
         Top             =   720
         Width           =   3615
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "1-800-XXXXXXX"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   13.5
            Charset         =   178
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   360
         Left            =   1530
         TabIndex        =   6
         Top             =   240
         Width           =   2250
      End
   End
   Begin VB.CommandButton cmdCheck 
      Caption         =   "确定(&O)"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   178
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4080
      TabIndex        =   4
      Top             =   4680
      Width           =   1455
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出(&E)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   4680
      Width           =   1455
   End
   Begin VB.TextBox txtSerial 
      Height          =   405
      IMEMode         =   3  'DISABLE
      Left            =   2040
      TabIndex        =   0
      Top             =   4080
      Width           =   3375
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "激活代码:"
      Height          =   180
      Left            =   390
      TabIndex        =   7
      Top             =   4215
      Width           =   810
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户编码:"
      Height          =   180
      Left            =   510
      TabIndex        =   3
      Top             =   360
      Width           =   825
   End
   Begin VB.Label lbl_HD_Serial_Number 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   12
         Charset         =   178
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1920
      TabIndex        =   2
      Top             =   360
      Width           =   3540
   End
End
Attribute VB_Name = "frmSerial"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:05/03/31
'描  述:一个通过硬件信息生成序列号的源码示例
'网  站:http://www.mndsoft.com
'e-mail:mnd@mndsoft.com
'OICQ  : 88382850
'****************************************************************************
Option Explicit
Dim Serial_Number, Activation_Code, Get_Serial_From_Registry
Private Sub cmdCheck_Click()
    
    Dim Res, Msg
    
'Check Serial

    If Activation_Code = Trim(txtSerial) Then
        
        SaveSetting "App_Name", "Registration", "Code", txtSerial
        Msg = "感谢您的注册. 请保存您的激活代码."
        Res = MsgBox(Msg, vbInformation, "感谢")
        frmMain.Text1 = Serial_Number
        frmMain.Text2 = Activation_Code
        Unload Me
        frmMain.Show
    
    Else
        Res = MsgBox("激活代码无效!", vbInformation, "错误!")
        txtSerial.SetFocus
    End If
   
End Sub
Private Sub cmdExit_Click()
    End
End Sub

Private Sub Command1_Click()
    InputBox "你的激活代码是: ", "", Activation_Code
End Sub

Private Sub Form_Load()
    
    Serial_Number = GetDriveInfo("C:\", GETDI_SERIAL) ' HD Serial Number
    
'simple calculation ( do your own )
    Activation_Code = Left(Serial_Number, 4)    'Left 4 digits
    Activation_Code = Activation_Code * 881999  'Multiply By 881999
    Activation_Code = Left(Activation_Code, 6)  'Get the left 6 Numbers Only

'check if user registerd before
    Get_Serial_From_Registry = GetSetting("App_Name", "Registration", "Code")
    
'If user already registerd then quit
    If Activation_Code = Get_Serial_From_Registry Then
        frmMain.Text1 = Serial_Number
        frmMain.Text2 = Activation_Code
        Unload Me
        frmMain.Show
'else show the HD serial code
    Else
        lbl_HD_Serial_Number = Serial_Number
    End If
 End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -