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

📄 frm_reg.frm

📁 提供给入门级别的GPRS编程人员
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{2B12169D-6738-11D2-BF5B-00A024982E5B}#31.8#0"; "CoolButton.OCX"
Begin VB.Form frm_reg 
   Caption         =   "GPRS用电管理系统"
   ClientHeight    =   4815
   ClientLeft      =   60
   ClientTop       =   555
   ClientWidth     =   4980
   Icon            =   "frm_reg.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4815
   ScaleWidth      =   4980
   StartUpPosition =   2  '屏幕中心
   Begin MSCommLib.MSComm MSComm1 
      Left            =   2400
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      ParitySetting   =   2
   End
   Begin VB.Frame Frame2 
      Height          =   735
      Left            =   0
      TabIndex        =   12
      Top             =   4080
      Width           =   4935
      Begin TButton.axButton xpcmdbutton2 
         Height          =   375
         Left            =   3600
         TabIndex        =   22
         Top             =   240
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   661
         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         =   "退  出"
         MaskColor       =   -2147483633
      End
      Begin TButton.axButton xpcmdbutton1 
         Height          =   375
         Left            =   1800
         TabIndex        =   21
         Top             =   240
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   661
         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         =   "注  册"
         MaskColor       =   -2147483633
      End
      Begin TButton.axButton Command1 
         Height          =   375
         Left            =   120
         TabIndex        =   23
         Top             =   240
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   661
         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         =   "主机上网"
         MaskColor       =   -2147483633
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "要填写的注册信息"
      ForeColor       =   &H00FF0000&
      Height          =   3975
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   4935
      Begin VB.TextBox txt_pw 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   12
         TabIndex        =   16
         Top             =   1800
         Width           =   1935
      End
      Begin VB.TextBox txt_sim 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   11
         TabIndex        =   11
         Top             =   1320
         Width           =   1935
      End
      Begin VB.TextBox txt_man 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   3
         TabIndex        =   9
         Top             =   3480
         Width           =   1935
      End
      Begin VB.TextBox txt_mobile 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   11
         TabIndex        =   7
         Top             =   2880
         Width           =   1935
      End
      Begin VB.TextBox txt_tel 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   11
         TabIndex        =   6
         Top             =   2280
         Width           =   1935
      End
      Begin VB.TextBox txt_name 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   15
         TabIndex        =   4
         Top             =   840
         Width           =   1935
      End
      Begin VB.TextBox txt_id 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1320
         MaxLength       =   6
         TabIndex        =   2
         Top             =   360
         Width           =   1935
      End
      Begin VB.Label Label12 
         BackStyle       =   0  'Transparent
         Caption         =   "(请加区号)"
         ForeColor       =   &H000000FF&
         Height          =   375
         Left            =   3360
         TabIndex        =   20
         Top             =   2400
         Width           =   1095
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   "(12位数字)"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   3360
         TabIndex        =   19
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "(最多15个汉字)"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   3360
         TabIndex        =   18
         Top             =   960
         Width           =   1455
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "(6位数字)"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   3360
         TabIndex        =   17
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "主机密码:"
         Height          =   375
         Left            =   120
         TabIndex        =   15
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Label Label11 
         BackStyle       =   0  'Transparent
         Caption         =   "注册人   :"
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   3600
         Width           =   1335
      End
      Begin VB.Label Label10 
         BackStyle       =   0  'Transparent
         Caption         =   "联系电话:"
         Height          =   375
         Left            =   120
         TabIndex        =   13
         Top             =   2400
         Width           =   1335
      End
      Begin VB.Label Label9 
         BackStyle       =   0  'Transparent
         Caption         =   "主机SIM号:"
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label Label8 
         BackStyle       =   0  'Transparent
         Caption         =   "联系手机:"
         Height          =   375
         Left            =   120
         TabIndex        =   8
         Top             =   3000
         Width           =   1095
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "       "
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   3000
         Width           =   975
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "区域名称 :"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "区域编号:"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   480
         Width           =   975
      End
   End
End
Attribute VB_Name = "frm_reg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_MouseEnter()
    Dim str As String
    Dim senddata() As Byte
    '//清空缓冲区
    ReDim bybuff(0) As Byte
    bybuff(0) = 0
    str = "ATJLWU"
    senddata = StrConv(str, vbFromUnicode)
    comsenddatame senddata
End Sub

Private Sub Form_Load()
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
    On Error GoTo errhandle
    With MSComm1
        .RThreshold = 1 '1个字节触发ONCOM事件
        .InputMode = comInputModeBinary
        .CommPort = GetInIKeyValue("com", "comport", App.Path & "\file\gprspcset.ini")
        .Settings = "9600,e,8" & MSComm1.CommPort
        .PortOpen = True
    End With
    MsgBox ("串口已经打开"), vbOKOnly + vbInformation, "提示"
    OpenCn
     '//清空缓冲区
    ReDim bybuff(0) As Byte
    bybuff(0) = 0
    Exit Sub
errhandle:
    MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "错误"
    End
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If MSComm1.PortOpen <> False Then MSComm1.PortOpen = False
    clors '关闭数据集
    clocn '关闭数据库
    
    '写在窗体
    UnloadAllFroms
End Sub


Private Sub MSComm1_OnComm() '串口接收事件(该算法2006/4/28完成)
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    Dim m As Integer
    Dim indata() As Byte
    Dim sgmsg() As Integer
    Dim tempbuff() As Byte
    Dim mymsg() As msg
    Dim myremsg As remsg
    Dim str As String
    j = 0
    k = 0
    m = 0
    
    Select Case MSComm1.CommEvent
    Case comEvReceive
        indata = MSComm1.Input
        For i = 0 To UBound(indata)
            If UBound(bybuff) = 0 And bybuff(0) = 0 Then
                bybuff(0) = indata(i)
            Else
                ReDim Preserve bybuff(UBound(bybuff) + 1)
                bybuff(UBound(bybuff)) = indata(i)
            End If
            
        Next i
        Debug.Print "*****************************************************************************"
        Debug.Print "本次收到的数据个数为:"
        Debug.Print UBound(indata) + 1
        Debug.Print "缓冲区内的数据总个数为:"

⌨️ 快捷键说明

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