Results 1 to 9 of 9

Thread: File Properties

  1. #1

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674

    File Properties

    When I right click on a file and choose 'Properties' I have a tab called 'Summary', in which there are several things such as 'Title', 'Subject', 'Comments', and some other stuff.

    I'm wondering if there is a way to access and write to these properties, and if so, how. I have tried with FSO but couldn't figure it out Any help would be greatly appreciated.

    JO
    "I have not failed. I've just found 10,000 ways that won't work."
    'Thomas Edison'

    "If we knew what it was we were doing it wouldn't be called research, would it?"
    'Albert Einstein'

    VB6

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: File Properties

    Checkout this link at M$:
    http://support.microsoft.com/kb/q224351/

    Although it says it's for VB.Net, it's supposed to work for any COM aware language.

    Good luck.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3
    New Member
    Join Date
    Jan 2005
    Posts
    13

    Re: File Properties

    The MS link helps only with OLEs not with any other kinds..what abt other file types..any code our there that supports all kinds of files?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: File Properties

    All you need to do is open the file's property sheet, programmatically. This will give you the same thing as right mouse clicking on a file from Windows Explorer.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Type SHELLEXECUTEINFO
    4.     cbSize        As Long
    5.     fMask         As Long
    6.     hwnd          As Long
    7.     lpVerb        As String
    8.     lpFile        As String
    9.     lpParameters  As String
    10.     lpDirectory   As String
    11.     nShow         As Long
    12.     hInstApp      As Long
    13.     lpIDList      As Long
    14.     lpClass       As String
    15.     hkeyClass     As Long
    16.     dwHotKey      As Long
    17.     hIcon         As Long
    18.     hProcess      As Long
    19. End Type
    20.  
    21. Private Const SEE_MASK_INVOKEIDLIST = &HC
    22. Private Const SEE_MASK_NOCLOSEPROCESS = &H40
    23. Private Const SEE_MASK_FLAG_NO_UI = &H400
    24.  
    25. Private Declare Function ShellExecuteEx Lib "shell32.dll" (SEI As SHELLEXECUTEINFO) As Long
    26.  
    27. Private Sub ShowProperties(FileName As String, OwnerhWnd As Long)
    28.  
    29.   'open a file properties property page for
    30.   'specified file if return value
    31.    Dim SEI As SHELLEXECUTEINFO
    32.   'Fill in the SHELLEXECUTEINFO structure
    33.    With SEI
    34.       .cbSize = Len(SEI)
    35.       .fMask = SEE_MASK_NOCLOSEPROCESS Or _
    36.                SEE_MASK_INVOKEIDLIST Or _
    37.                SEE_MASK_FLAG_NO_UI
    38.       .hwnd = OwnerhWnd
    39.       .lpVerb = "properties"
    40.       .lpFile = FileName
    41.       .lpParameters = vbNullChar
    42.       .lpDirectory = vbNullChar
    43.       .nShow = 0
    44.       .hInstApp = 0
    45.       .lpIDList = 0
    46.    End With
    47.  
    48.   'call the API to display the property sheet
    49.    Call ShellExecuteEx(SEI)
    50.  
    51. End Sub
    52.  
    53. Private Sub Command1_Click()
    54. With CommonDialog1
    55.    .CancelError = True
    56.    .InitDir = "C:\"
    57.    .ShowOpen
    58.    Call ShowProperties((.FileName), Me.hwnd)
    59. End With
    60. End Sub

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: File Properties

    is this for mp3 files by some chance??

    if so here is a program that can read and write to those properties, it is not written by me, but i have used some of the code.
    it appears to work on a NTFS files system, but i have not tried it it on a FAT file system and i believe there maybe be differences, as discussed in a thread a few days ago.



    Remember it writes to your mp3 files and until it is well tested should only be used on backups

    rgds pete
    Attached Files Attached Files

  6. #6
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: File Properties

    Quote Originally Posted by joltremari
    When I right click on a file and choose 'Properties' I have a tab called 'Summary', in which there are several things such as 'Title', 'Subject', 'Comments', and some other stuff.

    I'm wondering if there is a way to access and write to these properties, and if so, how.
    No you can't alter these properties, they are set when the exe is compiled. You can read them quite easily.

    Anyway why do you want to alter them? If you made the exe then its easy.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: File Properties

    well you can certainly change them in explorer, so chnging them by program would have to be possible too

    i don't think he is meaning exes, more likley docs or mp3s

    pete

  8. #8
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: File Properties

    Quote Originally Posted by westconn1
    well you can certainly change them in explorer, so chnging them by program would have to be possible too

    i don't think he is meaning exes, more likley docs or mp3s

    pete
    You can't change the properties of any file in Explorer well you can't with Win98.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: File Properties

    Quote Originally Posted by Keithuk
    You can't change the properties of any file in Explorer well you can't with Win98.
    That is true of most commerical software (such as the MS Office suite). Most VB .Exes, however, do permit this (I just compiled a Project1.Exe and I could update anything I wanted on the summary tab.)

    My assumption, of the original request however, was that he wanted to be able to update the Summary tab of documents and spreadsheets, and stuff like that.

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