Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to modify the file properties from Delphi?

298 views
Skip to first unread message

Bo Berglund

unread,
Jul 6, 2008, 6:50:30 AM7/6/08
to
If I rightclick a file in Windows Explorer and select "Properties"
then a window pops up with a tabbed dialogue. One of the tabs is
titled "Summary" and in this there are some items that one can
actually fill in, such as "Comments".

Now we have a customer request that when we use a particular file for
processing in an automation environment we should write to the comment
the timestamp of usage and some identifying string as well.
He will then use Windows Explorer with the Comment field enabled in
the right-hand pane (Detail view) to see which files have been used
and when.

It is not possible to modify the file contents itself because then it
gets unusable in the main application. Mostly the files in question
are program files for machine tools.

I guess that the "Comment" is some kind of NTFS metadata and now I
would like to know if it is possible to programmatically edit this
info using Delphi 7??


/BoB

Remy Lebeau (TeamB)

unread,
Jul 7, 2008, 2:07:13 PM7/7/08
to

"Bo Berglund" <bo.be...@telia.com> wrote in message
news:je81741v2ksng8qv5...@4ax.com...

> I guess that the "Comment" is some kind of NTFS metadata

Yes, it is. Specifically, it is part of the "Summary Information Property
Set" stream:

http://msdn.microsoft.com/en-us/library/aa380376(VS.85).aspx

> I would like to know if it is possible to programmatically edit this
> info using Delphi 7??

Yes, but there are several steps involved to reach it. Read the following
chaptre of MSDN for more details:

Structured Storage
http://msdn.microsoft.com/en-us/library/aa380369(VS.85).aspx

In a nutshell, you will need to use the StdCreateStorage/Ex() and/or
StdOpenStorage/Ex() function to retreive an IPropertySetStorage interface,
and then you can use that to update the Summary information as needed.


Gambit


Jens Gruschel

unread,
Jul 8, 2008, 10:27:22 AM7/8/08
to
> In a nutshell, you will need to use the StdCreateStorage/Ex() and/or
> StdOpenStorage/Ex() function to retreive an IPropertySetStorage interface,
> and then you can use that to update the Summary information as needed.

I guess that should have been StgCreateStorage/Ex() and/or
StgOpenStorage/Ex(). Anyway, quite interesting...

--
Jens Gruschel
http://www.pegtop.net

0 new messages