Results 1 to 3 of 3

Thread: File information get path ,filename,filesize,access date ,modified date

Threaded View

  1. #1

    Thread Starter
    Member sasikumar1's Avatar
    Join Date
    Nov 2006
    Posts
    56

    Post File information get path ,filename,filesize,access date ,modified date

    This tiny zip file have filename,filepath,fileaccess date,file modified date
    if picture file then size of the picture

    Thanks guys

    bellow code
    -------------------------------------------------------------------
    Private Const OF_READ = &H0&
    Private Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long
    Private Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
    Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long

    Dim lpFSHigh As Long
    Private fileN As String
    Private fileP As String
    Private fileS As Double
    Private fileC As String
    Private fileA As String
    Private fileH As Long
    Private fileW As Long
    Private fileX As String
    Dim fs As Scripting.File
    Private Sub Command1_Click()
    Call commonDialogCall
    Call GetFileS(fileX)
    Call FileWHget
    Call FileDateGet
    Call displayall
    End Sub
    Public Sub displayall()
    Label1.AutoSize = True
    Label2.AutoSize = True
    Label3.AutoSize = True
    Label4.AutoSize = True
    Label5.AutoSize = True
    Label6.AutoSize = True
    Label7.AutoSize = True

    Label1.Caption = "File name = " & fileN
    Label2.Caption = "File path = " & fileP
    Label3.Caption = "File size = " & fileS & " Byte"
    Label4.Caption = "File Created = " & fileC
    Label5.Caption = "File Accessed = " & fileA
    Label6.Caption = "File height = " & fileH
    Label7.Caption = "File Widht = " & fileW
    End Sub
    Public Sub commonDialogCall()
    CommonDialog1.Filter = "*.bmp"
    CommonDialog1.ShowOpen
    fileX = CommonDialog1.FileName
    fileN = CommonDialog1.FileTitle
    fileP = Left(CommonDialog1.FileName, Len(CommonDialog1.FileName) - (Len(CommonDialog1.FileTitle) + 1))
    End Sub
    Public Sub GetFileS(FilePath As String)

    Dim Pointer As Long, sizeofFile As Long
    Pointer = lOpen(FilePath, OF_READ)
    'size of the file
    sizeofFile = GetFileSize(Pointer, lpFSHigh)
    fileS = sizeofFile
    lclose Pointer
    End Sub
    Private Sub FileDateGet()
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(fileX)
    fileC = f.DateCreated
    fileA = f.DateLastModified
    End Sub

    Private Sub FileWHget()
    Dim pic As Picture
    Set pic = LoadPicture(fileX)
    fileH = pic.Height
    fileW = pic.Width
    End Sub

    Private Sub Command2_Click()
    End
    End Sub
    ---------------------------------
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width