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

📄 form1.frm

📁 RS485文件传送程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Send"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   930
      Left            =   1455
      TabIndex        =   0
      Top             =   945
      Width           =   1995
   End
   Begin VB.Label Label1 
      Height          =   330
      Left            =   1125
      TabIndex        =   1
      Top             =   2400
      Width           =   2220
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private gFileName As String

Private Sub Command1_Click()

    Dim FileNo As Integer

    Dim FileName As String
    
    Dim ReadByte As Byte
    
    Dim k As Long
    
    Dim oldtime As Long
    Dim newtime As Long
    Dim i As Long

'    Call mTools.CreateAfile("d:\a")
'
'    FileNo = FreeFile
'    Open "d:\a" For Binary Lock Read As #FileNo
'    Seek #FileNo, 1
'    Close #FileNo
    
    

'    FileSystem.ChDrive (Left(App.Path, 1))
'    FileSystem.ChDir (App.Path)
'
''    MsgBox FileSystem.CurDir
'    If FileSystem.Dir(mTools.JoinPath(App.Path, gFileName & ".rar")) <> "" Then
'        Call FileSystem.Kill(mTools.JoinPath(App.Path, gFileName & ".rar"))
'
'    End If
'
'    Call Shell("C:\Program Files\WinRAR\WinRAR.exe a   " & gFileName & ".rar  " & gFileName & ".mdb  ", vbHide)
'
'    Call Sleep(3000)

'
'    MsgBox FileSystem.FileLen(mTools.JoinPath(App.Path, "AirData.rar"))
    
    
'    等待一段时间
'    解压
'    Call Shell("C:\Program Files\WinRAR\WinRAR.exe x   AirData.rar    AirData.mdb  " & App.Path, vbHide)

    oldtime = timeGetTime
    
    
    For i = 9 To 5 Step -1
        Call Sleep(1500)
        Label1.Caption = "0"
        If SendFile(2, B19200, BIT_8 + STOP_1 + P_NONE, i, mTools.JoinPath(App.Path, gFileName & ".rar")) = True Then
            Me.Caption = Me.Caption & " Addr :" & i & "  ok"
    
        Else
            Me.Caption = Me.Caption & " Addr :" & i & "  Fail"
        End If
    
    Next i
    
    MsgBox timeGetTime - oldtime
    
End Sub

Private Sub Form_Load()
    gFileName = "Main"
End Sub

Private Sub Form_Unload(Cancel As Integer)
    End
End Sub

⌨️ 快捷键说明

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