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

📄 sn& imei 验证

📁 自己写的一个IMEI号码修改写入的小工具,适用于MTK平台,希望大家指导.
💻
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.ocx"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "MTK IMEI修改工具 v1.0"
   ClientHeight    =   4695
   ClientLeft      =   -945
   ClientTop       =   2145
   ClientWidth     =   9735
   Icon            =   "SN& IMEI 验证.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4695
   ScaleWidth      =   9735
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1 
      Caption         =   "设置"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1455
      Left            =   240
      TabIndex        =   7
      Top             =   3120
      Width           =   9255
      Begin VB.CommandButton Command2 
         Caption         =   "确 定"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   795
         Left            =   7200
         TabIndex        =   12
         Top             =   360
         Width           =   1065
      End
      Begin VB.TextBox Text6 
         Height          =   285
         Left            =   5160
         TabIndex        =   11
         Top             =   840
         Width           =   975
      End
      Begin VB.TextBox Text5 
         Height          =   315
         Left            =   5160
         MaxLength       =   2
         TabIndex        =   10
         Top             =   360
         Width           =   975
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         ItemData        =   "SN& IMEI 验证.frx":7D42
         Left            =   1800
         List            =   "SN& IMEI 验证.frx":7D64
         Style           =   2  'Dropdown List
         TabIndex        =   9
         Top             =   360
         Width           =   1185
      End
      Begin VB.ComboBox Combo2 
         Height          =   315
         ItemData        =   "SN& IMEI 验证.frx":7D87
         Left            =   1800
         List            =   "SN& IMEI 验证.frx":7DA0
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   840
         Width           =   1185
      End
      Begin VB.Label Label2 
         Caption         =   "IMEI号前2位"
         Height          =   225
         Index           =   1
         Left            =   3960
         TabIndex        =   16
         Top             =   405
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "串口"
         Height          =   225
         Index           =   2
         Left            =   1080
         TabIndex        =   15
         Top             =   405
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "波特率"
         Height          =   225
         Index           =   0
         Left            =   1080
         TabIndex        =   14
         Top             =   960
         Width           =   645
      End
      Begin VB.Label Label3 
         Caption         =   "开机延时(ms)"
         Height          =   255
         Left            =   3960
         TabIndex        =   13
         Top             =   840
         Width           =   1095
      End
   End
   Begin VB.TextBox Text4 
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   2895
      Left            =   5040
      MultiLine       =   -1  'True
      TabIndex        =   6
      Top             =   120
      Width           =   4455
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   0
      Top             =   1440
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.TextBox Text3 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   555
      Left            =   240
      Locked          =   -1  'True
      TabIndex        =   5
      Top             =   2400
      Width           =   4575
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00C0C0FF&
      Caption         =   "开始写入操作"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   600
      MaskColor       =   &H00FF0000&
      TabIndex        =   4
      Top             =   1440
      Width           =   4215
   End
   Begin VB.TextBox Text2 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   555
      Left            =   1680
      TabIndex        =   1
      Top             =   720
      Width           =   3045
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1680
      MaxLength       =   15
      TabIndex        =   0
      Top             =   120
      Width           =   3045
   End
   Begin VB.Label Label1 
      Caption         =   "读出的IMEI号"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Index           =   1
      Left            =   240
      TabIndex        =   3
      Top             =   840
      Width           =   1365
   End
   Begin VB.Label Label1 
      Caption         =   "请输入IMEI号"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Index           =   0
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   1275
   End
   Begin VB.Menu about 
      Caption         =   "关于"
      Index           =   1
      NegotiatePosition=   3  'Right
   End
   Begin VB.Menu quit 
      Caption         =   "退出"
      Index           =   2
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
  Dim com As String
  Dim datarate As String
  Dim powerontime As String
  Dim info As String
  Dim startimei, start, imei As String
  Dim pattern As String
  Dim compa As Boolean
  Dim repath As String
  Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  Dim temp, MyPos As String
  
Private Sub about_Click(Index As Integer)
  Load frmAbout
  frmAbout.Show
End Sub

Private Sub Command2_Click()
  Dim path1 As String
  path1 = App.Path + "\setting.ini"
  Open path1 For Output As #1
  Print #1, "[Comport]"
  Print #1, Combo1.Text
  Print #1, "[DateRate]"
  Print #1, Combo2.Text
  Print #1, "[PowerON time]"
  Print #1, Text2.Text
  Print #1, "[Startimei]"
  Print #1, Text1.Text
  Close #1
  Unload Form1
  Load Form1
  Form1.Show
End Sub

Private Sub Form_Load()
  Dim path1 As String
  Dim setting(12) As String
  Dim portset As String
  Dim msgtext, tile As String
  Dim i As String

  Text4.Text = "欢迎使用Huntel IMEI号码修改工具!" + vbCrLf


path1 = App.Path + "\setting.ini"
  Open path1 For Input As #1
  Line Input #1, setting(0)
  Line Input #1, setting(1)
  Line Input #1, setting(2)
  Line Input #1, setting(3)
  Line Input #1, setting(4)
  Line Input #1, setting(5)
  Line Input #1, setting(6)
  Line Input #1, setting(7)

Close #1
  com = setting(1)
  datarate = setting(3)
  powerontime = setting(5)
  startimei = setting(7)


  Text5.Text = startimei
  Combo1.Text = com
  Combo2.Text = datarate
  Text6.Text = powerontime
  On Error GoTo ER:
  portset = datarate + ",n,8,1"
  MSComm1.CommPort = com
  MSComm1.Settings = portset
  MSComm1.PortOpen = True
  Text3.BackColor = &HFF00&
  Text4.Text = Text4.Text + "串口初始化成功完成!" + vbCrLf
ER:  Select Case Err.Number
      Case Is = 8002
        Text4.Text = Text4.Text + "初始化失败:串口无效" + vbCrLf
        Text3.BackColor = &HFF&
      Case Is = 8015
        Text4.Text = Text4.Text + "初始化失败:波特率无效" + vbCrLf
         Text3.BackColor = &HFF&
      Case Is = 380
        Text4.Text = Text4.Text + "初始化失败:波特率无效" + vbCrLf
        Text3.BackColor = &HFF&
       
    End Select


End Sub


Private Sub quit_Click(Index As Integer)
  If MSComm1.PortOpen = True Then
    MSComm1.PortOpen = False
   Else
    Unload Me
  End If
 End
End Sub

Private Sub Text1_GotFocus()
  Text1.SelStart = 0
  Text1.SelLength = Len(Text1.Text)
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then Call Command1_Click
End Sub
               
Private Sub Command1_Click()
  Dim msg, stl, til, Response

On Error Resume Next
       Text4.Text = ""
   If Len(Text1.Text) = 15 And Left(Text1.Text, 2) = form2.Text1.Text Then
       Text4.Text = Text4.Text + "正在与手机通信……" + vbCrLf
       Sleep Val(powerontime)
       Text4.Refresh
       Text3.BackColor = &HC0C0C0
       'Form1.Refresh
       MSComm1.Output = "AT+ESLP=0" + Chr(13)
       Sleep 100
       MSComm1.OutBufferCount = 0
       MSComm1.Output = "AT+ESLP=0" + Chr(13)
       Sleep 100
       MSComm1.OutBufferCount = 0
       MSComm1.Output = "AT+ESLP=0" + Chr(13)
       Sleep 100
       MSComm1.OutBufferCount = 0
       MSComm1.Output = "AT+ESLP=0" + Chr(13)
       Sleep 100
        info = MSComm1.Input
       
        compa = info Like "*OK*"
        If compa = True Then
          Text4.Text = Text4.Text + "与手机连接成功" + vbCrLf
          Text4.Text = Text4.Text + "正在写IMEI号……" + vbCrLf
          Text4.Refresh
          
           Sleep 1000
           MSComm1.OutBufferCount = 0
           MSComm1.Output = "AT+EGMR=1,7,""" & Text1.Text & """" + Chr(13)
           Sleep 100
          
           MSComm1.OutBufferCount = 0
           MSComm1.Output = "AT+EGMR=0,7" + Chr(13)
           Sleep 100
           info = MSComm1.Input
           pattern = "*" & Text1.Text & "*"
          compa = info Like pattern
           If compa = True Then
              Text3.BackColor = &HFF00&
              Text1.SetFocus
              Text4.Text = Text4.Text + "校验成功" + vbCrLf
              Text4.Text = Text4.Text + "IMEI号写入成功" + vbCrLf
              
              temp = startimei
              MyPos = InStr(info, startimei)
              Text2.Text = Mid(info, MyPos, 15)
              Text2.Refresh
             Else
               Text4.Text = Text4.Text + "写入IMEI与手机内IMEI不相同" + vbCrLf
               Text4.Text = Text4.Text + "写入失败!!!!" + vbCrLf
               Text3.BackColor = &HFF&
               temp = startimei     'IMEI的开位字符
               MyPos = InStr(info, startimei) '指定IMEI的开位字符在AT结果中最先出现的位置,结果为数字
               Text2.Text = Mid(info, MyPos, 15)
               Text2.Refresh
            End If
         Else
           Text3.BackColor = &HFF&
           Text4.Text = Text4.Text + "与手机通信失败" + vbCrLf
           Text4.Refresh
        End If
            Text1.SetFocus
             Text1.SelStart = 0
             Text1.SelLength = Len(Text1.Text)
            
    Else '判断是否为15位后
      msg = "IMEI号位长度有误或开位字符不正确,请正确输入"
      til = "信息输入错误"
      stl = 16
      Response = MsgBox(msg, stl, til)
      Text1.SelStart = 0
      Text1.SelLength = Len(Text1.Text)
    End If
   
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
  If KeyAscii = 8 Then
   KeyAscii = 8
   Exit Sub
  End If
   If KeyAscii < 47 Or KeyAscii > 58 Then
     KeyAscii = 0
   End If
End Sub

Private Sub Text6_Change()
  If KeyAscii = 8 Then
   KeyAscii = 8
   Exit Sub
  End If
   If KeyAscii < 47 Or KeyAscii > 58 Then
     KeyAscii = 0
   End If
End Sub

⌨️ 快捷键说明

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