📄 frmdownloadhex.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
Begin VB.Form frmDownload
BorderStyle = 1 'Fixed Single
Caption = "EZ-USB(tm) Download .hex Files "
ClientHeight = 2505
ClientLeft = 150
ClientTop = 840
ClientWidth = 4740
Icon = "frmDownloadHex.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2505
ScaleWidth = 4740
StartUpPosition = 2 '屏幕中心
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 240
Left = 135
TabIndex = 4
Top = 1275
Visible = 0 'False
Width = 3960
_ExtentX = 6985
_ExtentY = 423
_Version = 393216
Appearance = 1
End
Begin VB.ComboBox cmbDriverName
Height = 315
ItemData = "frmDownloadHex.frx":0442
Left = 360
List = "frmDownloadHex.frx":0444
Style = 2 'Dropdown List
TabIndex = 3
ToolTipText = "Select EZ-USB device driver name"
Top = 690
Width = 1440
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1935
Top = 615
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DialogTitle = "Select Hex File..."
Filter = "8051 Hex Files (*.hex)|*.hex|8051 Bix files (*.bix)|*.bix"
End
Begin VB.CommandButton cmdDownloadFile
Caption = "Download File"
Height = 435
Left = 2550
TabIndex = 2
Top = 600
Width = 1650
End
Begin VB.Label lblComplete
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "Download complete."
Height = 195
Left = 1440
TabIndex = 6
Top = 1320
Visible = 0 'False
Width = 1455
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Download files to EZ-USB and EZ-USB FX Boards."
Height = 195
Index = 0
Left = 270
TabIndex = 5
Top = 105
Width = 3615
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Send questions or comments to usbapps@cypress.com"
Height = 195
Index = 9
Left = 180
TabIndex = 1
Top = 1680
Width = 3915
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Copyright (c) 2001 Cypress Semiconductor"
Height = 195
Index = 8
Left = 630
TabIndex = 0
Top = 1995
Width = 3000
End
Begin VB.Menu File
Caption = "File (&F)"
Begin VB.Menu Exit
Caption = "Exit (&x)"
Shortcut = ^X
End
End
End
Attribute VB_Name = "frmDownload"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' EZ-USB DownloadHex Example
' copyright (c) 2001 Cypress Semiconductor
Option Explicit
Public strBuffer As String
Private Sub cmdDownloadFile_Click()
Dim dirname As String
Dim x, lastx As Integer
CommonDialog1.InitDir = GetSetting("EZ-USB_DownloadHex", "Defaults", "Directory", "")
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
x = -1
lastx = 0
Do While x <> 0
x = InStr(lastx + 1, CommonDialog1.FileName, "\")
If x <> 0 Then: lastx = x
Loop
dirname = Left(CommonDialog1.FileName, lastx)
SaveSetting "EZ-USB_DownloadHex", "Defaults", "Directory", dirname
gDriver = cmbDriverName.Text
LoadHexFile CommonDialog1.FileName
End If
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Form_Load()
Dim index As Integer
Dim sDriverName As String
Dim hDriver As Long
Dim DeviceDescriptor As USB_DD
' find all the attached EZ-USB devices
' add device names to combo-box list
For index = 0 To MAX_USB_DEV_NUMBER - 1
sDriverName = "Ezusb-" & index
hDriver = OpenDriver(sDriverName)
If hDriver > 0 Then
cmbDriverName.AddItem sDriverName
CloseHandle hDriver
End If
Next
ProgressBar1.value = 0
If cmbDriverName.ListCount > 0 Then
cmbDriverName.Text = cmbDriverName.List(0)
GetDeviceDescriptor cmbDriverName.Text, DeviceDescriptor
Else
ErrMsg (eBadDriver)
End
End If
End Sub
Private Sub Form_Terminate()
Dim Segment As CSegment
' release memory
For Each Segment In gFirmwareCache
Set Segment = Nothing
Next
Set gFirmwareCache = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -