Results 1 to 7 of 7

Thread: [2005] Get extended file info

  1. #1

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    [2005] Get extended file info

    I know about the FileInfo class. I want to access other info though. Such as the info on the summary tab of a file's property dialog. Also, the assembly version.

    How is this done?
    Prefix has no suffix, but suffix has a prefix.

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Get extended file info

    Just so you know I am trying to help you out with this. I did something similar for image files where I wanted to get the photo date (if it exists) and here is some code on how I did it in one of my C# programs.

    Code:
    FileInfo[] sFiles;
                DirectoryInfo dInfo = new System.IO.DirectoryInfo(sSource);
    
                sFiles = dInfo.GetFiles("*.jpg");
                int i = 0;
    
                foreach (System.IO.FileInfo sFile in sFiles)
                {
                    i++;
                    
                    Image objImage = Image.FromFile(sFile.FullName);
                    System.Drawing.Imaging.PropertyItem objPropItem = objImage.GetPropertyItem(36867);
    
                    string sDateTime = System.Text.Encoding.ASCII.GetString(objPropItem.Value);
    
    ...
    I am looking into seeing how to get the assembly info and other things like that.

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Get extended file info

    Turns out File Version information is pretty easy:

    Code:
     MessageBox.Show(FileVersionInfo.GetVersionInfo("C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.exe").FileVersion)

  4. #4

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Get extended file info

    I know about the File Version Info and thanks for the code on image properties. Is that the way to read EXIF data in a jpeg?
    Prefix has no suffix, but suffix has a prefix.

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Get extended file info

    That C# code I posted does read the EXIF data, the getpropertyitem function is what reads it.

    Here is a good example from VBAccelerator:

    http://www.vbaccelerator.com/home/NE...es/article.asp

  6. #6

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Get extended file info

    Ok, thanks for the link. I converted some of it to try it out in vb.
    I am still trying to figure out how to get the info on the summary tab of a file's property dialog. I try searching Google but so many erroneous pages come up it's frustrating.
    Prefix has no suffix, but suffix has a prefix.

  7. #7
    Lively Member heeroyu16's Avatar
    Join Date
    Nov 2005
    Posts
    123

    Re: [2005] Get extended file info

    I have a sample code of what you may need.
    as for the Summary, I forgot the propid of it.

    vb Code:
    1. Dim image1 As System.Drawing.Image
    2.         Dim Title, Author, Keywords, Subject As String
    3.        
    4.         image1 = Drawing.Image.FromFile(picturePath)
    5.         Dim allProperty() As System.Drawing.Imaging.PropertyItem = image1.PropertyItems
    6.                
    7.         For Each propTemp As System.Drawing.Imaging.PropertyItem In allProperty
    8.             Select Case propTemp.Id
    9.                    Case 40091  'Title
    10.                         Title = System.Text.ASCIIEncoding.Unicode.GetString(propTemp.Value)
    11.                        
    12.                     Case 40092 'Comments
    13.                        Comments = System.Text.ASCIIEncoding.Unicode.GetString(propTemp.Value)
    14.                        
    15.                     Case 40093 'Author
    16.                         Author = System.Text.ASCIIEncoding.Unicode.GetString(propTemp.Value)
    17.                        
    18.                     Case 40094 'Keywords
    19.                         Keywords = System.Text.ASCIIEncoding.Unicode.GetString(propTemp.Value);
    20.                    
    21.                     Case 40095 'Subject
    22.                     subject = System.Text.ASCIIEncoding.Unicode.GetString(propTemp.Value)
    23.                     'Response.Write(subject.ToString) 'Doing testing on this
    24.             End Select
    25.         Next
    ---------------------------------------------------
    noob coder
    ---------------------------------------------------

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