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

📄 frmfilebrowse.frm

📁 AD9954源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmFileBrowse 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Browse For RAM File"
   ClientHeight    =   4455
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   6375
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4455
   ScaleWidth      =   6375
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.ComboBox cmbDutNum 
      Height          =   315
      ItemData        =   "frmFileBrowse.frx":0000
      Left            =   4920
      List            =   "frmFileBrowse.frx":000D
      Style           =   2  'Dropdown List
      TabIndex        =   11
      ToolTipText     =   "Choose the DUT."
      Top             =   120
      Width           =   1335
   End
   Begin VB.TextBox lblFileInfo 
      BackColor       =   &H8000000F&
      Height          =   975
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   10
      Top             =   3360
      Width           =   4695
   End
   Begin VB.ComboBox cmbFileTypes 
      Height          =   315
      ItemData        =   "frmFileBrowse.frx":0028
      Left            =   960
      List            =   "frmFileBrowse.frx":0035
      Style           =   2  'Dropdown List
      TabIndex        =   8
      Top             =   2760
      Width           =   4815
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   4920
      TabIndex        =   7
      Top             =   3840
      Width           =   1335
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "LOAD"
      Default         =   -1  'True
      Height          =   375
      Left            =   4920
      TabIndex        =   6
      Top             =   3360
      Width           =   1335
   End
   Begin VB.TextBox txtFile 
      Height          =   285
      Left            =   480
      TabIndex        =   4
      Top             =   120
      Width           =   3855
   End
   Begin VB.DriveListBox Drive1 
      Height          =   315
      Left            =   120
      TabIndex        =   2
      Top             =   480
      Width           =   2895
   End
   Begin VB.FileListBox File1 
      Height          =   2235
      Left            =   3060
      Pattern         =   "*.txt"
      TabIndex        =   1
      Top             =   480
      Width           =   3195
   End
   Begin VB.DirListBox Dir1 
      Height          =   1890
      Left            =   120
      TabIndex        =   0
      Top             =   840
      Width           =   2895
   End
   Begin VB.Label lblDUT2Load 
      Caption         =   "DUT:"
      Height          =   195
      Left            =   4440
      TabIndex        =   12
      ToolTipText     =   "Choose the DUT."
      Top             =   180
      Width           =   495
   End
   Begin VB.Label lblFileTypes 
      Caption         =   "File Types:"
      Height          =   195
      Left            =   120
      TabIndex        =   9
      Top             =   2820
      Width           =   1095
   End
   Begin VB.Label lblProperties 
      Caption         =   "File Info:"
      Height          =   195
      Left            =   120
      TabIndex        =   5
      Top             =   3120
      Width           =   1575
   End
   Begin VB.Label lblFile 
      Caption         =   "File:"
      Height          =   195
      Left            =   120
      TabIndex        =   3
      Top             =   180
      Width           =   375
   End
End
Attribute VB_Name = "frmFileBrowse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private ReturnVal As String


Private Sub cmbFileTypes_Click()
    Dim filter As String
    Dim listval As String
    Dim LParenLoc As Integer
    Dim ListValLen As Integer
    
    listval = cmbFileTypes.List(cmbFileTypes.ListIndex)
    LParenLoc = InStr(1, listval, "(")
    ListValLen = Len(listval)
    
    filter = Mid(listval, LParenLoc + 1, ListValLen - LParenLoc)
    filter = Mid(filter, 1, Len(filter) - 1)
    
    File1.Pattern = filter
End Sub

Private Sub cmdUpdateFileInfo_Click()
    'update the file info display
    UpdateFileInfoDisplay
End Sub

Private Sub cmdCancel_Click()
    ReturnVal = ""
    Me.Hide
End Sub

Private Sub cmdOK_Click()
    Dim cntr As Integer
    
    'Generate a file path
    If Right(File1.path, 1) = "\" Then
        'if the user selects a file in the root directory of a drive the
        'the path returned from file1.path will already have a \ character on it
        ReturnVal = File1.path & File1.filename
    Else
        ReturnVal = File1.path & "\" & File1.filename
    End If
    
    Me.Hide
    
    'Let the windows refresh them self
    For cntr = 0 To 100
        DoEvents
    Next cntr
End Sub

Private Sub Dir1_Change()
    File1.path = Dir1.path
    txtFile.Text = ""
    cmdOK.Enabled = False
End Sub

Private Sub Drive1_Change()
    Dir1.path = Drive1.Drive
    txtFile.Text = ""
    cmdOK.Enabled = False
End Sub

Private Sub File1_Click()
    txtFile.Text = File1.filename
    cmdOK.Enabled = True
    
End Sub

Private Sub Form_Load()
    'Setup the defualt values of the listboxes
    cmbFileTypes.ListIndex = 0
    cmbDutNum.ListIndex = 1
End Sub


Private Sub txtFile_Change()
    'Update the file info display
    UpdateFileInfoDisplay
End Sub

Private Sub txtFile_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
    End If
End Sub

Public Sub UpdateFileInfoDisplay()
    Dim FileHandle As Integer
    Dim Description As String
    Dim Dscr As String
    Dim FileRevNum As Integer
    Dim FileType As String
    Dim dummystr As String
    Dim RamFile As String
    
    'Get a sharable file handle
    FileHandle = FreeFile(1)
    
    If txtFile.Text <> "" Then
        If txtFile.Text = File1.filename Then
            If Right(txtFile.Text, 3) = "ram" Or Right(txtFile.Text, 3) = "txt" Then
                'Get the RAM file name
                RamFile = File1.path & "\" & File1.filename
                
                'Open the file
                Open RamFile For Input As #FileHandle
                
                'Read the file header back
                Input #FileHandle, FileType, FileRevNum
                'Make sure its a valid file
                If FileType = "AD9859 RAM Configuration File" Then
                    'Trash the next 4 lines
                    Input #FileHandle, dummystr
                    Input #FileHandle, Dscr, Description
                    lblFileInfo.Text = "File Type:  " & FileType & vbCrLf & "Revision:  " & FileRevNum & vbCrLf
                    lblFileInfo.Text = lblFileInfo.Text & "Description:  " & Description
                Else
                    lblFileInfo.Text = "Not available for this file!"
                End If
                
                Close #FileHandle
            Else
                lblFileInfo.Text = "Not available for this file!"
            End If
        Else
            lblFileInfo.Text = "Not available for this file!"
        End If
    Else
        lblFileInfo.Text = "No file selected!"
    End If
End Sub

'Shows the dialog as a Open dialog
'which only allows you to select files that exist
Public Function ShowDialog(ByVal DialogTitle As String, ByVal ButtonText As String, ByRef DUTNum As Integer, ByVal InitPath As String, Optional HideDUTInfo) As String
    
    'Setup the form
    Me.Caption = DialogTitle
    Me.cmdOK.Caption = ButtonText
    
    If InitPath = "" Then
        'Use the application path
        Drive1.Drive = App.path
        Dir1.path = App.path
    Else
        'Use the passed path if it exists
        If FileExists(InitPath) Then
            Drive1.Drive = InitPath
            Dir1.path = InitPath
        Else
            'Use the application path
            Drive1.Drive = App.path
            Dir1.path = App.path
        End If
    End If
    
    If Not IsMissing(HideDUTInfo) Then
        If HideDUTInfo = True Then
            Me.lblDUT2Load.Visible = False
            Me.cmbDutNum.Visible = False
        Else
            Me.lblDUT2Load.Visible = True
            Me.cmbDutNum.Visible = True
        End If
    End If
    
    
    'Show the form as modal
    Me.Show 1
    
    'Return the DUT Number selected
    DUTNum = cmbDutNum.ListIndex
    'Return the filename
    ShowDialog = ReturnVal
    Me.Hide 'Hide the form
    Me.Refresh 'Make sure it hides now
    Unload Me 'Unload to save resources
End Function

⌨️ 快捷键说明

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