Sign In
The Great Flying Tortoise
A hard-boiled look at Win32 C++ programming and the property system
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Tags
.NET
General
indexing
Property Handlers
Property System
reading properties
Tagging
troubleshooting
World of Warcraft
writing properties
Browse by Tags
MSDN Blogs
>
The Great Flying Tortoise
>
All Tags
>
property system
Tagged Content List
Blog Post:
Code for Previous Blog Posts
benkaras
Someone asked if I had a copy of the code I've been using in my blog so far. Well, I didn't as of 5pm today, so I went back and collected the code into 3 projects: propreader.exe <file> - Prints a list of all properties we know about the file propwriter.exe <file> <property>...
on
10 Jan 2007
Blog Post:
Choosing your property API
benkaras
It is time that I talk a little about what to do if you want your application to run on XP. There are three sets of APIs, each with subtle differences and caveats, and ultimately your choice requires deciding what platform your application must run on: Windows Vista: Call IShellItem2 :: GetPropertyStore...
on
5 Jan 2007
Blog Post:
Writing properties #9 - Summary
benkaras
Coding to the Windows SDK Reading properties #7 - Summary Writing properties #1 - Simple beginnings Writing properties #2 - Filetype support? Writing properties #3 - Which properties are writable? Writing properties #4 - Which properties are writable? Writing properties #5 - Property lists Writing...
on
21 Nov 2006
Blog Post:
Writing properties #8 - Canonical Values
benkaras
There's one last topic I want to touch on before I close this series: Canonical values. So far I've talked about how to determine when the property itself is writable. But once you decide to write a property, how do you figure out what type the value should be? What if you get it wrong? The first...
on
15 Nov 2006
Blog Post:
The deal with IPropertyStoreCapabilities
benkaras
Have you ever felt this before? It's the day after you send your product to manufacturing . You step back, look at the big picture, and start to see minor flaws. A dread sinks in when you realize you just blogged about it too! That was Monday morning. :-) The good news is that our analysis shows that...
on
14 Nov 2006
Blog Post:
Writing properties #7 - IPropertyStoreCapabilities requires GPS_READWRITE
benkaras
[Edit: 2006/11/13 - My original post got this topic entirely backwards. I've fixed the title and will provide details about this tomorrow. ] -Ben Karas
on
10 Nov 2006
Blog Post:
Writing properties #6 - GPS_READWRITE omits read-only data sources
benkaras
You'll recall that there are multiple layers in the property system . In particular, the GPS_DEFAULT property system stack for files in the filesystem namespace looks like this: [ Application using GPS_DEFAULT ] [ Coercion Layer ] [ Shell Item Layer ]* [ File System Namespace ]* [ Property Handler...
on
9 Nov 2006
Blog Post:
Writing properties #5 - Property lists
benkaras
So if a property handler doesn't enumerate which properties it supports writing , then how does the explorer pick which properties to show? Well, the shell namespace extension containing the item specifies the list of properties it wants to show in a particular piece of UI. To query this property list...
on
7 Nov 2006
Blog Post:
Writing properties #4 - Which properties are writeable?
benkaras
I'm going to make a first stab at printing out a list of properties that are writable for a given file. I'll spoil the fun and let you know that my attempt today will not fully succeed. I'll explain later. For now, let's see some code! You'll recall I wrote a program to loop through the properties...
on
6 Nov 2006
Blog Post:
Writing properties #1 - Simple beginnings
benkaras
I'm going to be talking about writable properties over the next few days. I know that some of you are itching to try this out yourselves, so here is an overly simplistic program that will write a single property to a file. I have omitted a lot of diagnostic code, so this will not work for all files,...
on
16 Oct 2006
Blog Post:
Gotcha: You must release property stores quickly
benkaras
The general rule is that you should minimize the length of time you have a property store open. It is best to acquire the data you need and then release the store. Read-only property stores lock files for reading using a filesystem oplock . An oplock does more than just lock a file -- it blocks writers...
on
13 Oct 2006
Blog Post:
Properties coding expedition #7 - The final output
benkaras
This coding expedition has developed a tool that can dump out all the properties on a file. If you are curious about the property system, I highly recommend you build this tool and run it on various file types. Coding to the Windows SDK Part 1 - Binding to an item Part 2 - Printing the IPropertyStore...
on
12 Oct 2006
Blog Post:
Properties coding expedition #6 - Developer friendly output
benkaras
Using the tool I developed in this series, I know that my test photo has " Rating: 5 Stars ". But how is this value actually represented in the JPG itself? Let's answer that by adding some developer friendly output. Here's what I did: First, I need a developer-friendly label. I can get the canonical...
on
11 Oct 2006
Blog Post:
Properties coding expedition #5 - Stripping characters
benkaras
In Part 4 , I discovered that WideCharToMultiByte converts certain invisible non-spacing Unicode characters to ?. This makes the output look really silly in a command line application. I want to keep this as a command line application, so I need to strip these characters away. A simple helper solves...
on
10 Oct 2006
Blog Post:
Properties coding expedition #4 - The output
benkaras
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...
on
6 Oct 2006
Blog Post:
Properties coding expedition #3 - Printing a value
benkaras
In parts one and two , I started writing a program to print out the properties on an item. But I saved the best for last -- printing a value. Discussion follows the code. HRESULT _PrintPropertyValue(__in REFPROPERTYKEY key, __in REFPROPVARIANT propvar) { IPropertyDescription *ppropdesc; HRESULT...
on
5 Oct 2006
Blog Post:
Properties coding expedition #2 - printing the IPropertyStore
benkaras
Last time we saw how to bind to a shell item and get its property store. Today, we loop through the store printing out known properties. HRESULT _PrintPropertyStore(IPropertyStore *pps) { DWORD cProps; HRESULT hr = pps-> GetCount (&cProps); for (DWORD i = 0; SUCCEEDED(hr) && i <...
on
4 Oct 2006
Blog Post:
Properties coding expedition #1 - Binding to an item
benkaras
The goal of this first expedition is to print lists of properties from items. This will give insight into the origins and capabilities of these different properties. Feel free to follow along and try out different things. There's a lot to explore. I am splitting this and future programming expeditions...
on
3 Oct 2006
Blog Post:
Coding to the Windows SDK
benkaras
In the near future I'll be posting code examples that compile and run. In case you'd like to follow along, here's my personal setup. My code should compile on RC1 also, so go ahead and use RC1 if that's what you can get a hold of. Windows Vista Sept CTP (Build 5728) The matching Windows SDK...
on
2 Oct 2006
Blog Post:
PROPVARIANT Helpers #7 - Locale sensitivity and the helper APIs
benkaras
As I went through the property helper posts, I kept using those dense word combinations " locale sensitive " and " locale insensitive ". Why? Because locale tells your computer whether to display a number as "5.3" or "5,3". Should "5,305" be a big number or a little one? Locale governs type conversions...
on
27 Sep 2006
Blog Post:
PROPVARIANT Helpers #6 - PropVariantCompare[Ex]
benkaras
In general, PropVariantCompare performs a locale-sensitive comparison between two values and returns <0, 0, or >0 as appropriate. PropVariantCompare always tries to convert the values to the type of the first value. Thus if code tries to compare values of different types, they will becompared...
on
22 Sep 2006
Blog Post:
PROPVARIANT Helpers #4 - Vector Helpers
benkaras
One of the more prominent properties is PKEY_Keywords , e.g. "Tags". This is a vector property, and so it usually comes packaged in a PROPVARIANT with VT_VECTOR|VT_LPWSTR . If you deal with properties such as this, you may find the following helpers useful: PSSTDAPI_(ULONG) PropVariantGetElementCount...
on
20 Sep 2006
Blog Post:
PROPVARIANT Helpers #3 - Simpler reading functions
benkaras
You may have noticed that most of the PROPVARIANT helpers return an HRESULT. This makes them easy to use in conjunction with COM calling patterns like the following: IPropertyStore pps = ... PROPVARIANT propvar = {0}; HRESULT hr = InitPropVariantFromInt32(100, &propvar); if (SUCCEEDED(hr))...
on
19 Sep 2006
Blog Post:
PROPVARIANT Helpers #2 - Reading single values
benkaras
Reading a PROPVARIANT seems innocuous, but it suffers from many of the same dangers as does initializating one of these structures . I highly recommend that you instead use the following helpers to aid your code's readability and reduce your error rate. If the data is not exactly the right type, these...
on
18 Sep 2006
Blog Post:
PROPVARIANT helpers #1 - Initialization
benkaras
PROPVARIANTs are easy to misuse . Because the data members are so cryptic, it is easy to get confused or to overlook errors. To help alleviate these and other problems (including readability), we provide a series of PROPVARIANT helpers for common uses. There are a lot of 'em, so I will split this...
on
15 Sep 2006
Page 1 of 2 (36 items)
1
2