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

📄 frm_ip.frm

📁 提供给入门级别的GPRS编程人员
💻 FRM
字号:
VERSION 5.00
Object = "{2B12169D-6738-11D2-BF5B-00A024982E5B}#31.8#0"; "CoolButton.OCX"
Begin VB.Form frm_ip 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "GPRS用电管理系统"
   ClientHeight    =   1395
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5415
   Icon            =   "frm_ip.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1395
   ScaleWidth      =   5415
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin TButton.axButton xpcmdbutton1 
      Height          =   330
      Left            =   4320
      TabIndex        =   4
      Top             =   360
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   582
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "请求IP"
      MaskColor       =   -2147483633
   End
   Begin VB.TextBox txt_ip 
      Appearance      =   0  'Flat
      Height          =   330
      Left            =   1800
      TabIndex        =   3
      Top             =   960
      Width           =   2295
   End
   Begin VB.TextBox txt_sim 
      Appearance      =   0  'Flat
      Height          =   330
      Left            =   1800
      TabIndex        =   1
      Top             =   360
      Width           =   2295
   End
   Begin VB.Label Label3 
      Caption         =   "请求终端IP"
      ForeColor       =   &H00FF0000&
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "终端IP为:"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   1050
      Width           =   855
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "请求终端SIM号:"
      Height          =   255
      Left            =   360
      TabIndex        =   0
      Top             =   450
      Width           =   1335
   End
End
Attribute VB_Name = "frm_ip"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()
    txt_sim.Text = ""
    txt_ip.Text = ""
End Sub

Private Sub xpcmdbutton1_Click()
    Dim strsql As String
    Dim str1 As String
    Dim str2 As String
    Dim str3 As String
    Dim str4 As String
    Dim senddata() As Byte
    Dim i As Integer
    Dim num As Integer
    If frm_main.ActiveBar21.Bands("statusbar").Tools("s1").Caption = "现在状态GSM    " Then
       MsgBox ("现在状态GSM,您无法取得终端IP!"), vbOKOnly + vbCritical, "错误"
       Unload Me
       Exit Sub
    End If
    If Trim(txt_sim.Text) = "" Then
       MsgBox ("用户SIM号不能为空!"), vbOKOnly + vbCritical, "错误"
       Exit Sub
    End If
    strsql = "select user_biaohao from userbasic where user_sim='" & Trim(txt_sim.Text) & "'"
    openrs strsql
    If rs.EOF Then
       MsgBox ("不存在该用户,请仔细查看SIM号!"), vbOKOnly + vbCritical, "错误"
       Exit Sub
       clors
    End If
    str3 = Trim(txt_sim.Text)
    str4 = rs.Fields("user_biaohao").Value
    clors
    strsql = "select gongdiansuo_pw,gongdiansuo_regcode from gongdiansuoreg "
    openrs strsql
    str1 = rs.Fields("gongdiansuo_pw").Value
    str2 = rs.Fields("gongdiansuo_regcode").Value
    clors
    ReDim senddata(21) As Byte
    For i = 0 To 5 Step 1 '主机密码
        num = Mid(str1, 2 * (i - 0) + 1, 2)
        senddata(i) = num
    Next i
    For i = 6 To 9 Step 1 '主机注册码
        num = Mid(str2, 2 * (i - 6) + 1, 2)
        senddata(i) = num
    Next i
    For i = 10 To 14 Step 1 'SIM卡号(前5字节)
        num = Mid(str3, 2 * (i - 10) + 1, 2)
        senddata(i) = num
    Next i
    num = Mid(str3, 11, 1) 'SIM卡号(后1字节)
    senddata(15) = num
    
    For i = 16 To 21 Step 1 '表号
        num = Mid(str4, 2 * (i - 16) + 1, 2)
        senddata(i) = num
    Next i
    
    
    Dim strregdata1 As String
    Dim regdata1() As Byte
    Dim regdata2() As Byte
'    Dim tempregdata2() As Byte
    Dim regdata() As Byte
    Dim numregdata As Integer
'    Dim i As Integer
    Dim centerip As String
    Dim centerport As String
    centerip = GetInIKeyValue("center", "centerip", App.Path & "\file\gprspcset.ini")
    centerport = GetInIKeyValue("center", "centerport", App.Path & "\file\gprspcset.ini")
    strregdata1 = "ATJAU" & centerip & "PORT:" & centerport
    regdata1 = StrConv(strregdata1, vbFromUnicode)
    regdata2 = qrryip_pctocenter(senddata)
    numregdata = UBound(regdata1) + UBound(regdata2) + 2
    ReDim regdata(numregdata - 1) As Byte
    For i = 0 To UBound(regdata1) Step 1
        regdata(i) = regdata1(i)
    Next i
    For i = UBound(regdata1) + 1 To numregdata - 1
        regdata(i) = regdata2(i - UBound(regdata1) - 1)
    Next i
    comsenddata regdata '发送数据
    '//清空缓冲区
    ReDim bybuff(0) As Byte
    bybuff(0) = 0
End Sub

⌨️ 快捷键说明

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