Sunday, August 7, 2011

Customizing Windows 7 Explorer Infotip

Expanding on my previous post on
Customizing Windows 7 mp3 infotip to display album, song title, in this post, I try to explain a little more on customizing Windows 7 Explorer infotip in a generic manner, for any type of files already recognized by Windows.



A registry entry in HKEY_CLASSES_ROOT\SystemFileAssociations\ contains settings for how Windows behaves for different types of files, according to the file extension. Very often, for each extension, an entry named "FullDetails" as well as "InfoTip" exists.

The "FullDetails" entry contains all the file information that Windows understands for this type of file. For example, for a MP3 file, information such as "System.Music.AlbumTitle" and "System.Audio.EncodingBitrate" are available, representing the album title, or the audio bitrate of the the MP3 file.

The "InfoTop" entry, in comparison, contains the file information that Windows will display, when you hover the mouse over a file in Windows Explorer. It already contains some sensible values, but if you would like more information, or a different set to be displayed, look inside "FullDetails" to find the property that seems closest to the information you're trying to display, and insert that property into the "InfoTip" entry, in the order you desire. Properties are separated with a semi-colon (;).
 

HKEY_CLASSES_ROOT\SystemFileAssociations\.jpg

To give another real-life application, the default information displayed for JPG picture files are only the file type (JPG), the date taken, rating, the size of the picture (in pixels), and the size of the file.


Or in other words, the registry Infotip entry contains the following properties by default:
prop:System.ItemType;System.Photo.DateTaken;System.Keywords;*System.Photo.PeopleNames;System.Rating;*System.Image.Dimensions;*System.Size;System.Title

I would like to display more information in the Windows Explorer infotip, so I changed the registry entry to:
prop:System.ItemType;System.Photo.DateTaken;System.Keywords;*System.Photo.PeopleNames;System.Rating;*System.Image.Dimensions;*System.Size;System.PropGroup.Camera;System.Photo.CameraManufacturer;System.Photo.CameraModel;System.Photo.MeteringMode;System.Photo.ExposureProgram;System.Photo.ExposureBias;System.Photo.ExposureTime;System.Photo.FNumber;System.Photo.ISOSpeed;System.Photo.WhiteBalance;System.Photo.LensManufacturer;System.Photo.LensModel;System.Photo.FocalLengthInFilm;System.Photo.FocalLength;System.Photo.SubjectDistance;System.Photo.Flash;System.Photo.FlashEnergy;System.Photo.FlashManufacturer;System.Photo.FlashModel;System.Photo.LightSource;System.Title

Now, I no longer need to open another program just to see various technical details for the image.


For completeness, image files are historically named JPEG. Therefore I would apply the same changes to "HKEY_CLASSES_ROOT\SystemFileAssociations\.jpeg" so that the same information is displayed for JPEG files.

7 comments:

Anonymous said...

Thanks for the great post! I finally got the infotip to show the comments on my pictures. Also, do you happen to know what do the asterisks do?

David Carr said...

Agreed - great info thx. Quick question: do you know how to refresh what is being shown after changing a value in the registry? That is, without logging off/on.

Ho Hock Jim said...

Whether or not logging on/off depends how the program behaves; whether it reads the registry once (at startup), or periodically checks the registry.

In the context of this article, it seems like logging off is the easiest way.

I supposed kill the explorer.exe process should work, since it restarts itself. But do note this is a drastic measure which may have adverse impact elsewhere...

David Carr said...

Agreed Jim - killing Explorer seems harsh, as suggested here by Brink in terms of rebuilding the icon cache.
http://www.sevenforums.com/tutorials/49819-icon-cache-rebuild.html

I never found out how this might be possible to cause a refresh programmatically, but I did discover that when right-clicking on a file and choosing 'Open With' seems to cause the information to be refreshed. Not via an API...but at least not requiring Explorer to be killed nor reboot.

On another note, do you know the explanation of what the asterisk prefix means? (ie *System.Size)

Also, do you know of a MS page which gives a full listing of all the different properties that are available?

Lastly, I am trying to find an article (MS or otherwise) describing how to embed properties (eg DocAuthor) in my own custom file format. Any suggested links?

Thanks a lot!

Ho Hock Jim said...

Am hazarding a guess that the asterisk caters for fields that contain more than one value. For example, "*System.Photo.PeopleNames" could contain multiple people in the photo, and "*System.Image.Dimensions" would contain the number of horizontal and vertical pixel.

No idea on the rest. Programming isn't one of my strong suit. :)

David Carr said...

Jim...just to follow up for the sake of Anonymous' original post as well as anyone else who stumbles across this thread. The asterisk found as the subkey name refers to all files:
[HKLM\Software\Classes\*]
as mentioned in this article:
http://msdn.microsoft.com/en-ca/library/windows/desktop/cc144067.aspx#infotips

And the use of the asterisk within the name of the property list hides as opposed to shows the property as referenced here:
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144133.aspx

Ho Hock Jim said...

Thanks David!