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

📄 frmmain.frm

📁 大量优秀的vb编程
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "获得文件属性"
   ClientHeight    =   4572
   ClientLeft      =   3108
   ClientTop       =   3336
   ClientWidth     =   6972
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   4572
   ScaleWidth      =   6972
   Begin VB.Frame Frame1 
      Caption         =   "文件属性"
      Height          =   3732
      Left            =   120
      TabIndex        =   1
      Top             =   0
      Width           =   6732
      Begin VB.Frame fradates 
         Caption         =   "时间信息"
         Height          =   1332
         Left            =   2400
         TabIndex        =   14
         Top             =   1440
         Width           =   3375
         Begin VB.Label lbldate 
            Caption         =   "00/00/0000 00:00:00"
            Height          =   255
            Index           =   2
            Left            =   1560
            TabIndex        =   20
            Top             =   960
            Width           =   1695
         End
         Begin VB.Label lbldatetxt 
            Caption         =   "最后访问时间:"
            Height          =   255
            Index           =   2
            Left            =   240
            TabIndex        =   19
            Top             =   960
            Width           =   1215
         End
         Begin VB.Label lbldate 
            Caption         =   "00/00/0000 00:00:00"
            Height          =   252
            Index           =   1
            Left            =   1560
            TabIndex        =   18
            Top             =   600
            Width           =   1692
         End
         Begin VB.Label lbldatetxt 
            Caption         =   "最后修改时间:"
            Height          =   255
            Index           =   1
            Left            =   240
            TabIndex        =   17
            Top             =   600
            Width           =   1215
         End
         Begin VB.Label lbldatetxt 
            Caption         =   "文件创建时间:"
            Height          =   255
            Index           =   0
            Left            =   240
            TabIndex        =   16
            Top             =   240
            Width           =   1215
         End
         Begin VB.Label lbldate 
            Caption         =   "00/00/0000 00:00:00"
            Height          =   255
            Index           =   0
            Left            =   1560
            TabIndex        =   15
            Top             =   240
            Width           =   1695
         End
      End
      Begin VB.Frame fraattrib 
         Caption         =   "读写属性"
         Height          =   2175
         Left            =   240
         TabIndex        =   6
         Top             =   1320
         Width           =   1695
         Begin VB.CheckBox attributes 
            Caption         =   "隐藏文件"
            Height          =   195
            Index           =   1
            Left            =   240
            TabIndex        =   13
            Top             =   360
            Width           =   1215
         End
         Begin VB.CheckBox attributes 
            Caption         =   "系统文件"
            Height          =   195
            Index           =   2
            Left            =   240
            TabIndex        =   12
            Top             =   600
            Width           =   1215
         End
         Begin VB.CheckBox attributes 
            Caption         =   "只读文件"
            Height          =   195
            Index           =   3
            Left            =   240
            TabIndex        =   11
            Top             =   840
            Width           =   1215
         End
         Begin VB.CheckBox attributes 
            Caption         =   "存档文件"
            Height          =   195
            Index           =   4
            Left            =   240
            TabIndex        =   10
            Top             =   1080
            Width           =   1215
         End
         Begin VB.CheckBox attributes 
            Caption         =   "临时文件"
            Height          =   195
            Index           =   5
            Left            =   240
            TabIndex        =   9
            Top             =   1320
            Width           =   1215
         End
         Begin VB.CheckBox attributes 
            Caption         =   "压缩文件"
            Height          =   195
            Index           =   7
            Left            =   240
            TabIndex        =   8
            Top             =   1800
            Width           =   1215
         End
         Begin VB.CheckBox attributes 
            Caption         =   "一般文件"
            Height          =   195
            Index           =   6
            Left            =   240
            TabIndex        =   7
            Top             =   1560
            Width           =   1215
         End
      End
      Begin VB.TextBox txtname 
         Height          =   375
         Left            =   840
         Locked          =   -1  'True
         TabIndex        =   5
         Top             =   240
         Width           =   5532
      End
      Begin VB.TextBox txtsize 
         Height          =   375
         Left            =   840
         Locked          =   -1  'True
         TabIndex        =   4
         Top             =   720
         Width           =   5532
      End
      Begin VB.Label lblsize 
         Caption         =   "文件大小:"
         Height          =   372
         Left            =   120
         TabIndex        =   3
         Top             =   720
         Width           =   732
      End
      Begin VB.Label lblname 
         Caption         =   "文件名称:"
         Height          =   372
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   612
      End
   End
   Begin VB.CommandButton ok 
      Cancel          =   -1  'True
      Caption         =   "退出程序"
      Default         =   -1  'True
      Height          =   495
      Left            =   840
      TabIndex        =   0
      Top             =   3960
      Width           =   5175
   End
   Begin MSComDlg.CommonDialog dialog 
      Left            =   240
      Top             =   3960
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      CancelError     =   -1  'True
      DialogTitle     =   "File Info Demo Project"
      Filter          =   "All Files (*.*) | *.*"
      Flags           =   2101252
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False






Public Sub updatestats()
Dim ftime As SYSTEMTIME               ' Initialise variables
Dim tfilename As String
tfilename = dialog.FileName
Dim filedata As WIN32_FIND_DATA

filedata = Findfile(tfilename)        ' Get information

txtname = tfilename                   ' Put name in text box

If filedata.nFileSizeHigh = 0 Then    ' Put size into text box
  txtsize = filedata.nFileSizeLow & " Bytes"
Else
  txtsize = filedata.nFileSizeHigh & "Bytes"
End If

Call FileTimeToSystemTime(filedata.ftCreationTime, ftime)   ' Determine Creation date and time, then format it
lbldate(0) = ftime.wDay & "/" & ftime.wMonth & "/" & ftime.wYear & " " & ftime.wHour & ":" & ftime.wMinute & ":" & ftime.wSecond
Call FileTimeToSystemTime(filedata.ftLastWriteTime, ftime)  ' Determine Last Modified date and time
lbldate(1) = ftime.wDay & "/" & ftime.wMonth & "/" & ftime.wYear & " " & ftime.wHour & ":" & ftime.wMinute & ":" & ftime.wSecond
Call FileTimeToSystemTime(filedata.ftLastAccessTime, ftime) ' Determine Last accessed date (note no time is recorded)
lbldate(2) = ftime.wDay & "/" & ftime.wMonth & "/" & ftime.wYear

If (filedata.dwFileAttributes And FILE_ATTRIBUTE_HIDDEN) = FILE_ATTRIBUTE_HIDDEN Then
  attributes(1).Value = 1 ' Determine if file has hidden attribute set
Else
  attributes(1).Value = 0
End If
If (filedata.dwFileAttributes And FILE_ATTRIBUTE_SYSTEM) = FILE_ATTRIBUTE_SYSTEM Then
  attributes(2).Value = 1 ' Determine if file has system attribute set
Else
  attributes(2).Value = 0
End If
If (filedata.dwFileAttributes And FILE_ATTRIBUTE_READONLY) = FILE_ATTRIBUTE_READONLY Then
  attributes(3).Value = 1 ' Determine if file has readonly attribute set
Else
  attributes(3).Value = 0
End If
If (filedata.dwFileAttributes And FILE_ATTRIBUTE_ARCHIVE) = FILE_ATTRIBUTE_ARCHIVE Then
  attributes(4).Value = 1 ' Determine if file has archive attribute set
Else
  attributes(4).Value = 0
End If
If (filedata.dwFileAttributes And FILE_ATTRIBUTE_TEMPORARY) = FILE_ATTRIBUTE_TEMPORARY Then
  attributes(5).Value = 1 ' Determine if file has temporary attribute set
Else
  attributes(5).Value = 0
End If
If (filedata.dwFileAttributes And FILE_ATTRIBUTE_NORMAL) = FILE_ATTRIBUTE_NORMAL Then
  attributes(6).Value = 1 ' Determine if file has normal attribute set
Else
  attributes(6).Value = 0
End If
If (filedata.dwFileAttributes And FILE_ATTRIBUTE_COMPRESSED) = FILE_ATTRIBUTE_COMPRESSED Then
  attributes(7).Value = 1 ' Determine if file has compressed attribute set
Else
  attributes(7).Value = 0
End If
End Sub

Private Sub attributes_GotFocus(Index As Integer)
ok.SetFocus     ' Make it impossible to change check boxes
End Sub


Private Sub Form_Load()

dialog.ShowOpen ' Show open common dialog box
updatestats     ' Update infomation on form
Me.Show         ' Show the form
ok.SetFocus     ' Set focus to Done button
Exit Sub

End Sub


Private Sub ok_Click()
End
End Sub


⌨️ 快捷键说明

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