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

📄 frmdevicesetup.frm

📁 用VB编写的接收卫星接收机的是数据
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmDeviceSetup 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "打开/配置设备向导 Step1 —— 打开设备"
   ClientHeight    =   4785
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   6765
   Icon            =   "frmDeviceSetup.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4785
   ScaleWidth      =   6765
   StartUpPosition =   1  '所有者中心
   Begin VB.PictureBox picBanner 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   825
      Left            =   0
      Picture         =   "frmDeviceSetup.frx":0CCA
      ScaleHeight     =   795
      ScaleWidth      =   6765
      TabIndex        =   13
      Top             =   0
      Width           =   6800
      Begin VB.Label lblBannerTitle 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Ezusb Open and Setup Wizard"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FFFFFF&
         Height          =   300
         Left            =   120
         TabIndex        =   14
         Top             =   120
         Width           =   4455
      End
   End
   Begin VB.CheckBox chkNext 
      Caption         =   "继续执行向导"
      Height          =   255
      Left            =   480
      TabIndex        =   12
      Top             =   4320
      Value           =   1  'Checked
      Width           =   1695
   End
   Begin MSComDlg.CommonDialog cmmDlg 
      Left            =   6000
      Top             =   1800
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   5160
      TabIndex        =   11
      Top             =   4200
      Width           =   1215
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定"
      Height          =   375
      Left            =   3840
      TabIndex        =   10
      Top             =   4200
      Width           =   1215
   End
   Begin VB.TextBox txtDatafilePath 
      Height          =   300
      Left            =   1440
      TabIndex        =   8
      Top             =   3405
      Width           =   3975
   End
   Begin VB.CommandButton cmdDatafileOpen 
      Appearance      =   0  'Flat
      Height          =   400
      Left            =   5520
      Picture         =   "frmDeviceSetup.frx":A03C
      Style           =   1  'Graphical
      TabIndex        =   7
      ToolTipText     =   "打开"
      Top             =   3360
      Width           =   400
   End
   Begin VB.CommandButton cmdFirmwareOpen 
      Appearance      =   0  'Flat
      Height          =   400
      Left            =   5520
      Picture         =   "frmDeviceSetup.frx":B07E
      Style           =   1  'Graphical
      TabIndex        =   5
      ToolTipText     =   "打开"
      Top             =   2160
      Width           =   400
   End
   Begin VB.TextBox txtFirmwarePath 
      Height          =   300
      Left            =   1440
      TabIndex        =   4
      Top             =   2205
      Width           =   3975
   End
   Begin VB.CommandButton cmdRefresh 
      Caption         =   "刷新"
      Height          =   360
      Left            =   4705
      Picture         =   "frmDeviceSetup.frx":C0C0
      TabIndex        =   2
      Top             =   1200
      Width           =   1215
   End
   Begin VB.ComboBox combDevices 
      Height          =   300
      Left            =   2520
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   1230
      Width           =   2055
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Height          =   45
      Left            =   135
      TabIndex        =   9
      Top             =   4080
      Width           =   6495
   End
   Begin VB.Label lblDatafilePath 
      AutoSize        =   -1  'True
      Caption         =   "* 数据存储文件路径:"
      Height          =   180
      Left            =   480
      TabIndex        =   6
      Top             =   3120
      Width           =   1710
   End
   Begin VB.Label lblFirmwarePath 
      AutoSize        =   -1  'True
      Caption         =   "  请选择可用的固件配置代码(*.hex):"
      Height          =   180
      Left            =   480
      TabIndex        =   3
      Top             =   1920
      Width           =   3060
   End
   Begin VB.Label lblDevices 
      AutoSize        =   -1  'True
      Caption         =   "* 请选择可用的Ezusb设备:"
      Height          =   180
      Left            =   480
      TabIndex        =   0
      Top             =   960
      Width           =   2160
   End
End
Attribute VB_Name = "frmDeviceSetup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdCancel_Click()
  frmDeviceSetup.Hide
  Unload frmDeviceSetup
End Sub

Private Sub cmdDatafileOpen_Click()
cmmDlg.Filter = "*.* (数据文件)|*.*"
cmmDlg.FileName = ""
cmmDlg.ShowSave
txtDatafilePath.Text = Trim(cmmDlg.FileName)
End Sub



Private Sub cmdFirmwareOpen_Click()
cmmDlg.Filter = "*.hex (十六进制8051固件代码)|*.hex"
cmmDlg.FileName = ""
cmmDlg.ShowOpen
txtFirmwarePath.Text = Trim(cmmDlg.FileName)
End Sub

Private Sub cmdOk_Click()
Dim retval As Long

' Start 8051 Chip
' Until Application Quit or Reopen another Device
If Trim(txtDatafilePath.Text) = "" Then
   MsgBox "请指定数据存储文件"
   Exit Sub
End If

With frmMain.ezlibObj
 ' If Some Device opened Now,close it
 'If .IsChipRunning = ChipIsRunning Then .StopChip
  If Len(Trim(.CurrentDeviceName)) <> 0 Then
    .CloseDevice ' it will StopChip and Close Device
    ' Clear the Device Descriptor
    Call procFillDeviceDescriptor(False)
    ' Clear the Configuration Descriptor
    Call procFillConfigurationDescriptor(False)
  End If
  
 ' 1,Open Device
  If .OpenDevice(combDevices.List(combDevices.ListIndex)) = 1 Then
  'If .OpenDevice("Ezusb-0") = 1 Then
      MsgBox "打开设备 " + combDevices.List(combDevices.ListIndex) + " 失败"
      Exit Sub
  End If
  
  '2. Download Firmware code if it's specified and Start Chip
  '   Finally it will Fill Descriptor Feilds into FlexGrid Control Cells
  retval = procDownload(txtFirmwarePath.Text)
  Select Case retval
  Case 1:
         MsgBox "代码加载失败"
         .CloseDevice
         Exit Sub
  Case 2:
         MsgBox "启动固件代码配置设备失败"
         .CloseDevice
         Exit Sub
  End Select
  
  
End With


  ' 3. Store the Paths
frmMain.strDatafilePath = Trim(txtDatafilePath.Text)
frmMain.strFirmwarePath = Trim(txtFirmwarePath.Text)

frmDeviceSetup.Hide

' 4. Show next Step
If chkNext.Value = 1 Then
  g_blWorking = False
  Call procTransferSetup
End If

End Sub

Private Sub cmdRefresh_Click()
If g_blWorking <> True Then
  g_blWorking = True

' Refresh Devices List
Call procFillDeviceList
  
  g_blWorking = False
End If
End Sub



Private Sub Form_Load()
' Init Devices List
Call procFillDeviceList

' Fill Textboxes
txtFirmwarePath.Text = frmMain.strFirmwarePath
txtDatafilePath.Text = frmMain.strDatafilePath
End Sub

Private Sub procFillDeviceList()
Dim strDeviceName As String
Dim ezlibTmp As New EZlib1
  frmMain.lblWorkName.Caption = "正在寻找可用的设备..."
  frmMain.prgsWork.Max = optLngDevTo - optLngDevFrom + 1
  frmMain.prgsWork.Min = 1
  
  combDevices.Clear
  
  For i = optLngDevFrom To optLngDevTo
     strDeviceName = "Ezusb-" + CStr(i)
     
     If ezlibTmp.OpenDevice(strDeviceName) = 0 Then
         combDevices.AddItem strDeviceName
     End If
     
     If Len(Trim(ezlibTmp.CurrentDeviceName)) <> 0 Then
         ezlibTmp.CloseDevice
     End If
     
     frmMain.prgsWork.Value = i + 1
     frmMain.lblPrecent.Caption = CStr(Int(i / frmMain.prgsWork.Max * 100)) + "%"
     
     DoEvents
  Next i
  
  frmMain.lblWorkName = ""
  frmMain.lblPrecent.Caption = ""
  frmMain.prgsWork.Value = 1
  
  If combDevices.ListCount > 0 Then
     combDevices.ListIndex = 0
     Call procEnableButtons(True)
  Else
     Call procEnableButtons(False)
  End If
  
  ' Init Check box's value, the Check Box marks weather to Set Transfer Ctrl Next
  If frmMain.blIsTransCtrlSet = True Then
   ' won't set TransferCtrl  in Next Step
    chkNext.Value = 0
  Else
   ' Will Show frmTransferStep to set TransferCtrl in Next Step
    chkNext.Value = 1
  End If
  
End Sub

Private Sub procEnableButtons(Flag As Boolean)
  If Flag = True Then
    txtFirmwarePath.Enabled = True
    cmdFirmwareOpen.Enabled = True
    
    txtDatafilePath.Enabled = True
    cmdDatafileOpen.Enabled = True
    
    cmdOk.Enabled = True
  Else
    txtFirmwarePath.Enabled = False
    cmdFirmwareOpen.Enabled = False
    
    txtDatafilePath.Enabled = False
    cmdDatafileOpen.Enabled = False
    
    cmdOk.Enabled = False
  End If
End Sub

⌨️ 快捷键说明

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