Change file comments

J

jman

I've been asked to develop an application which, on some certain stage
during its execution, must take some text files on disk and change their
"comments" property, which is easily accessed from windows explorer, just by
clicking properties and writing them down, so I assume there must be some
framework or Win32 API function or whatever to accomplish that.

I'm aware of the FileVersionInfo class, but help states only executable
files have version info, and that text files don't, so I guess there must be
some other way.

If any of you know about this, I'd be most grateful, since I need this very
urgently.

Thanks.
 
P

Peter Duniho

jman said:
I've been asked to develop an application which, on some certain stage
during its execution, must take some text files on disk and change their
"comments" property [...]

I'm aware of the FileVersionInfo class, but help states only executable
files have version info, and that text files don't, so I guess there must
be some other way.

I believe that FileVersionInfo is looking at the executable file itself,
which contains in its header the information returned by the FileVersionInfo
class. So you're right, this isn't what you want.

For the "Summary" information you're trying to retrieve, as far as I know
there's no .NET support for it (which seems odd, so I might have missed
something). You can probably use interop to get at it easily though, as
it's a COM/OLE thing:

http://msdn.microsoft.com/library/d.../stg/the_summary_information_property_set.asp

Pete
 
J

jman

Peter Duniho said:
jman said:
I've been asked to develop an application which, on some certain stage
during its execution, must take some text files on disk and change their
"comments" property [...]

I'm aware of the FileVersionInfo class, but help states only executable
files have version info, and that text files don't, so I guess there must
be some other way.

I believe that FileVersionInfo is looking at the executable file itself,
which contains in its header the information returned by the
FileVersionInfo class. So you're right, this isn't what you want.

For the "Summary" information you're trying to retrieve, as far as I know
there's no .NET support for it (which seems odd, so I might have missed
something). You can probably use interop to get at it easily though, as
it's a COM/OLE thing:

http://msdn.microsoft.com/library/d.../stg/the_summary_information_property_set.asp

Pete

Thanks to Google Groups, I got the answer yesterday. It's quite tricky and
you must rely on com interfaces, but it works like a charm (but a bit slow)

The info is here:
http://groups.google.es/group/micro...st&q=c#+file+comments&rnum=1#99a5dd5c80c084b5
 
J

jman

"Gaurav Vaish (www.EdujiniOnline.com)"
Comments on a plain-text (.txt) file? That would be a news for me... at
least for non-Vista OS!



--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujinionline.com
http://eduzine.edujinionline.com

Just get any .txt file you have on disk, right click on it and then on
properties, and you'll find with I'm talking about. I think it's the
"Summary" tab (don't lnow the exact name, since I use Windows in Spanish).
There, you have some metadata, like comments, author, title, and so on.
That's the info I was talking about.

Anyway, I got the solution. Look for the reply I've just posted under the
other guy who replied
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top