Partilhar via


Properties coding expedition #4 - The output

The program itself is provided in parts 1, 2, and 3. So I compiled my program and ran it from the command line. Here's a snippet of what I got back:

Properties for 'scan0010.jpg'
Folder name: propshow
Type: JPEG Image
Name: scan0010.jpg
Size: 638 KB
Attributes: A
Date modified: ?9/?29/?2006 ??10:12 PM
Date created: ?9/?30/?2006 ??8:00 AM
Date accessed: ?9/?30/?2006 ??8:00 AM
Title: Mountain goat
Authors: Ben Karas
Tags: Sol Duc Valley; Wildlife
Content created: ?9/?29/?2006 ??10:12 PM
Date last saved: ?9/?29/?2006 ??10:12 PM
Width: ?1139 pixels
Height: ?769 pixels
Horizontal resolution: ?200 dpi
Vertical resolution: ?200 dpi
Bit depth: 24
Dimensions: ?1139 x 769?
Rating: 5 Stars
...[snip 20 more lines]...

Ok, now you get a sense about what properties are on a file! JPGs happen to be one of the better supported filetypes on the system. We can see titles, authors, ratings, dimensions, etc on JPG files.  Also notice the variety of information. Some items are dates, others are numbers. There's even a list of tags in there!

Now the question you really want to ask is "What are those "?" doing in there?" This is a very common question. The ? result from a bad UNICODE->OEM conversion. IPropertyDescription::FormatForDisplay inserts UNICODE LTR and RTL characters (0x200e and 0x200f). These characters let English strings display correctly on Arabic builds. Arabic strings get similar characters so that they display correctly on left to right builds.  UNICODE applications display these LTR and RTL characters correctly. 

But the command line (and WideCharToMultiByte) for some reason converts these to "?". Oops. 

 This is a time when I wish FormatForDisplay had a flag to strip these characters out; alas.

Comments

  • Anonymous
    November 05, 2006
    This coding expedition has developed a tool that can dump out all the properties on a file. If you are