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

📄 ht-comm.frm

📁 HT系列掌机与电脑通讯VB软件(含源码)
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{5C77FCD1-3883-49E5-A997-BEC25BBAAF35}#1.0#0"; "WHT2.ocx"
Object = "{1B9A0ECD-DAC6-4534-9ABF-F918ED1DDC8E}#1.0#0"; "HTLIST2.ocx"
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   BorderStyle     =   1  'Fixed Single
   Caption         =   "兰德HT系列手持电脑通讯测试程序 (VB2Demo)"
   ClientHeight    =   7305
   ClientLeft      =   30
   ClientTop       =   330
   ClientWidth     =   8880
   Icon            =   "vb2demo.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   7305
   ScaleWidth      =   8880
   StartUpPosition =   1  'CenterOwner
   Begin HTFileList2.HTList2 HTList21 
      Height          =   4335
      Left            =   120
      TabIndex        =   35
      Top             =   480
      Width           =   8655
      _ExtentX        =   15266
      _ExtentY        =   7646
   End
   Begin VB.Frame Frame6 
      Height          =   3615
      Left            =   240
      TabIndex        =   14
      Top             =   600
      Visible         =   0   'False
      Width           =   8415
      Begin VB.TextBox Text7 
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "HH.mm"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   4
         EndProperty
         Height          =   375
         Left            =   3720
         MaxLength       =   10
         TabIndex        =   20
         Top             =   2040
         Width           =   1455
      End
      Begin VB.TextBox Text6 
         BackColor       =   &H8000000F&
         Enabled         =   0   'False
         Height          =   375
         Left            =   6360
         TabIndex        =   21
         Top             =   480
         Width           =   1455
      End
      Begin VB.TextBox Text5 
         BackColor       =   &H8000000F&
         Enabled         =   0   'False
         Height          =   375
         Left            =   3660
         TabIndex        =   18
         Top             =   480
         Width           =   1455
      End
      Begin VB.TextBox Text4 
         BackColor       =   &H8000000B&
         Enabled         =   0   'False
         Height          =   375
         Left            =   960
         TabIndex        =   17
         Top             =   480
         Width           =   1455
      End
      Begin VB.CommandButton NowPcTime 
         Caption         =   "PC机系统时间"
         Height          =   495
         Left            =   5640
         TabIndex        =   25
         Top             =   3000
         Width           =   1335
      End
      Begin VB.CommandButton htsettime 
         Caption         =   "设HT时间"
         Height          =   495
         Left            =   3660
         TabIndex        =   24
         Top             =   3000
         Width           =   1335
      End
      Begin VB.CommandButton ReadHTInfo 
         Caption         =   "读HT信息"
         Height          =   495
         Left            =   1680
         TabIndex        =   23
         Top             =   3000
         Width           =   1335
      End
      Begin VB.TextBox Text2 
         DataField       =   "4"
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "yyyy""年""M""月""d""日"""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   3
         EndProperty
         Height          =   375
         Left            =   1680
         MaxLength       =   15
         TabIndex        =   19
         Top             =   2040
         Width           =   1815
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H8000000F&
         Enabled         =   0   'False
         Height          =   375
         Left            =   1680
         TabIndex        =   22
         Top             =   1320
         Width           =   3495
      End
      Begin VB.Label Label10 
         Caption         =   "生产批号"
         Height          =   375
         Left            =   5520
         TabIndex        =   34
         Top             =   480
         Width           =   735
      End
      Begin VB.Label Label9 
         Caption         =   "机型号"
         Height          =   375
         Left            =   2880
         TabIndex        =   33
         Top             =   480
         Width           =   615
      End
      Begin VB.Label Label8 
         Caption         =   "机身号"
         Height          =   375
         Left            =   240
         TabIndex        =   32
         Top             =   480
         Width           =   615
      End
      Begin VB.Label Label5 
         Caption         =   "设置时间"
         Height          =   495
         Left            =   240
         TabIndex        =   16
         Top             =   2040
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "HT当前时间"
         Height          =   375
         Left            =   240
         TabIndex        =   15
         Top             =   1440
         Width           =   1095
      End
   End
   Begin ComctlLib.TabStrip TabStrip1 
      Height          =   4935
      Left            =   120
      TabIndex        =   13
      Top             =   120
      Width           =   8655
      _ExtentX        =   15266
      _ExtentY        =   8705
      MultiRow        =   -1  'True
      Style           =   1
      _Version        =   327682
      BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
         NumTabs         =   2
         BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "HT文件通讯"
            Key             =   ""
            Object.Tag             =   "1"
            Object.ToolTipText     =   "HT文件通讯服务"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "HT时间设置"
            Key             =   ""
            Object.Tag             =   "2"
            Object.ToolTipText     =   "HT掌上电脑时间设置"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Frame Frame7 
      Height          =   3135
      Left            =   240
      TabIndex        =   26
      Top             =   960
      Visible         =   0   'False
      Width           =   8415
      Begin VB.TextBox Text3 
         Height          =   495
         Left            =   960
         TabIndex        =   29
         Text            =   "Text3"
         Top             =   1320
         Width           =   3855
      End
      Begin VB.CommandButton Command4 
         Caption         =   "选择文件"
         Height          =   495
         Left            =   5400
         TabIndex        =   28
         Top             =   1200
         Width           =   1215
      End
      Begin VB.CommandButton Command5 
         Caption         =   "升级软件"
         Height          =   495
         Left            =   5400
         TabIndex        =   27
         Top             =   2160
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "HT ROM 文件名"
         Height          =   255
         Left            =   1920
         TabIndex        =   31
         Top             =   840
         Width           =   1455
      End
      Begin VB.Label Label7 
         Caption         =   " "
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   555
         Left            =   960
         TabIndex        =   30
         Top             =   2280
         Width           =   3705
      End
   End
   Begin VB.TextBox TB_Serial 
      Alignment       =   1  'Right Justify
      Height          =   300
      Left            =   6840
      TabIndex        =   2
      Text            =   "0"
      ToolTipText     =   "输入PC机序列号(0至65535)"
      Top             =   5160
      Width           =   1575
   End
   Begin VB.CommandButton CM_COMM2 
      Caption         =   "DLL通讯(&T)"
      Enabled         =   0   'False
      Height          =   396
      Left            =   7347
      TabIndex        =   4
      ToolTipText     =   "调用Whtcombs.dll与手持电脑进行文件通讯"
      Top             =   6300
      Width           =   1308
   End
   Begin VB.CommandButton CM_EXIT 
      Caption         =   "退出(&E)"
      Height          =   396
      Left            =   7347
      TabIndex        =   5
      ToolTipText     =   "退出程序"
      Top             =   6840
      Width           =   1308
   End
   Begin VB.ComboBox CB_Port 
      Height          =   315
      Left            =   1080
      Style           =   2  'Dropdown List
      TabIndex        =   0
      ToolTipText     =   "选择PC机通讯口(Com1至Com4)"
      Top             =   5160
      Width           =   1575
   End
   Begin VB.ComboBox CB_Baud 
      Height          =   315
      ItemData        =   "vb2demo.frx":030A
      Left            =   3960
      List            =   "vb2demo.frx":030C
      Style           =   2  'Dropdown List
      TabIndex        =   1
      ToolTipText     =   "选择PC机波特率(9600,19200,38400,57600,115200)"
      Top             =   5160
      Width           =   1575
   End
   Begin VB.CommandButton CM_COMM1 
      Caption         =   "OCX通讯(&C)"
      Enabled         =   0   'False
      Height          =   396
      Left            =   7347
      TabIndex        =   3
      ToolTipText     =   "调用Whtocx与手持电脑进行文件通讯"
      Top             =   5760
      Width           =   1308
   End
   Begin VB.Frame Frame2 
      Caption         =   "通讯"
      Height          =   1644
      Left            =   120
      TabIndex        =   6
      Top             =   5640
      Width           =   7140
      Begin WHT2.WHTOCX2 WHTOCX21 
         Height          =   1335
         Left            =   120
         TabIndex        =   36
         Top             =   240
         Width           =   6975
         _ExtentX        =   12303
         _ExtentY        =   2355
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
   End
   Begin VB.Frame Frame3 
      Height          =   495
      Left            =   120
      TabIndex        =   7
      Top             =   5040
      Width           =   2775
      Begin VB.Label Label3 
         Caption         =   "PC机通讯口"
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   120
         Width           =   1020
      End
   End
   Begin VB.Frame Frame5 
      Height          =   492
      Left            =   5640
      TabIndex        =   9
      Top             =   5040
      Width           =   2895
      Begin VB.Label Label1 
         Caption         =   "PC机序列号"
         Height          =   210
         Left            =   120
         TabIndex        =   10
         Top             =   120
         Width           =   975
      End
   End
   Begin VB.Frame Frame4 
      Height          =   492
      Left            =   2880
      TabIndex        =   11
      Top             =   5040
      Width           =   2775
      Begin VB.Label Label2 
         Caption         =   "PC机波特率"
         Height          =   255
         Left            =   120
         TabIndex        =   12
         Top             =   120
         Width           =   945
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function ExFPut Lib "ht32dll.dll" (ByVal PCFile As String, ByVal HTFile As String, ByVal iPort As Integer, ByVal iBaud As Long, ByVal iSerialNo As Integer) As Integer
Private Declare Function ExFGet Lib "ht32dll.dll" (ByVal PCFile As String, ByVal HTFile As String, ByVal iPort As Integer, ByVal iBaud As Long, ByVal iSerialNo As Integer) As Integer
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

Private CountOfName As Integer
Private iPort As Integer
Private iBaud As Long
Private iSerial As Long
Private oldcomm1 As Boolean
Private oldcomm2 As Boolean



Private Sub CB_Port_Click()
    WHTOCX21.ResetCommPort
    iPort = CB_Port.ListIndex + 1
End Sub

Private Sub CB_Baud_Click()
    WHTOCX21.ResetCommPort
    iBaud = CLng(CB_Baud.Text)
End Sub
Private Sub CM_EXIT_Click()
    End
End Sub

Private Sub HTSetTime_Click()
    Dim result As Integer
    Dim cTimer(0 To 6) As Byte
    Dim cTemp(0 To 15) As Byte
    Dim cTemp1() As Byte
    Dim TimerStr As String
    Dim i As Integer
    Dim j As Integer
            
    htsettime.Enabled = False
    ReadHTInfo.Enabled = False
    
    cTimer(0) = 0     'month
    cTimer(1) = 0     'date
    cTimer(2) = 0     'year low
    cTimer(3) = 0     'year high
    cTimer(4) = 0     'hours
    cTimer(5) = 0     'minute
    cTimer(6) = 0     'second
   
    'calculate year month date
    j = 0
    Text2.Text = Text2.Text + " "
    cTemp1 = StrConv(Text2.Text, vbFromUnicode)
    For i = LBound(cTemp1) To UBound(cTemp1)
       If cTemp1(i) >= 48 And cTemp1(i) <= 57 Then
           cTemp(j) = cTemp1(i)
           j = j + 1
         If j = 4 Then
           cTimer(2) = ((cTemp(0) - 48) * 1000 + (cTemp(1) - 48) * 100 + (cTemp(2) - 48) * 10 + (cTemp(3) - 48)) Mod 256
           cTimer(3) = (((cTemp(0) - 48) * 1000 + (cTemp(1) - 48) * 100 + (cTemp(2) - 48) * 10 + (cTemp(3) - 48)) - cTimer(2)) / 256
         End If
         If j = 5 Then
            If cTemp1(i + 1) >= 48 And cTemp1(i + 1) <= 57 Then
               cTimer(0) = (cTemp(4) - 48) * 10 + cTemp1(i + 1) - 48
               i = i + 1
            Else
               cTimer(0) = (cTemp(4) - 48)
            End If
         End If
         If j = 6 Then
            If cTemp1(i + 1) >= 48 And cTemp1(i + 1) <= 57 Then
               cTimer(1) = (cTemp(5) - 48) * 10 + cTemp1(i + 1) - 48
            Else
               cTimer(1) = (cTemp(5) - 48)
            End If
         End If
       End If
    Next
    
    'calculate hours minute
    j = 0
    Text7.Text = Text7.Text + " "
    cTemp1 = StrConv(Text7.Text, vbFromUnicode)

⌨️ 快捷键说明

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