Getting and setting file properties eg Tags/Comments
Hi
Is it possible to get and set file properties such as the Tags or Comments properties
(in file explorer browse to the folder containing the file you are looking at, then right click the folder column headers which starts with "name" and then check the properties such as tags, comments, etc)?
Re: Getting and setting file properties eg Tags/Comments
Extended properties are metadata that apply to different kinds of files. Something like a DOC file is an OLE Storage that contains multiple OLE Streams, many Streams having well-known names that the Shell knows about. An MP3 file has another way of embedding metadata, as does a JPG file, and so on.
Shell offers several ways (Shell32 API calls, Shell32 COM objects) to read these, but not to write them. To do that your program needs to understand each file format you want to manipulate. Microsoft offers a library for handling Office binary formats. See http://support.microsoft.com/kb/224351
Re: Getting and setting file properties eg Tags/Comments
Thanks for the good info in the reply dilettante. I noticed that some engineers had problems using Dsofile.dll for files such as text files, presumably as these do not use the OLE Structured Storage format. I am looking at exe files, and I don't think they will use the OLE Structured Storage format either.
The exe file format in Windows is 32-bit portable executable, and 64-bit portable executable. (http://en.wikipedia.org/wiki/EXE). I had a brief look at the PE specification (be warned it goes into a lot of detail) http://www.google.com.au/#q=executab...w=1903&bih=922 although I was not able to see an area which was designed to be read and written to for tags or comments.
Re: Getting and setting file properties eg Tags/Comments
Yes, it can be a lot of work to manipulate these values. Windows Explorer just provides display of the values as a user service. They are really considered to be "owned" by applications that "own" each file format. For EXEs that would be compilers and linkers.
I'm not sure it makes sense to change something for a program like the company name, version number, etc. anyway. They are not really meant for users to fiddle with.
Re: Getting and setting file properties eg Tags/Comments
I found this: half way down this page (http://vb.mvps.org/samples/Console/) in the section "Required Modification of Executable" there is a one liner to adjust the console bit in the PE header:
WSHShell.Run strLINK & " /EDIT /SUBSYSTEM:CONSOLE " & strEXE
Which means if I was just able to work out what section to update for tags/comments it might not be that much work...
Also I tried a hack by adding a custom tag to the end of the exe i.e. write 100 characters at the end of the binary exe file, and surprisingly the exe still works.