Welcome to MSDN Blogs Sign
in | Join
| Help

The Great Flying
Tortoise

A hard-boiled look at Win32 C++ programming and the property
system

RSS 2.0

Atom 1.0

Home

About

Email

<

August 2006

>

Su

Mo

Tu

We

Th

Fr

Sa

30

31

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

1

2

3

4

5

6

7

8

9

Search
Go

Archives

August 2006
(2)

Post Categories

General
(0)

Property
System (2)

Blogroll

The Old New
Thing

Sorting It
Out

Performance
Tidbits

Tuesday, August 29, 2006 5:00 PM benkaras

Property consumerism

Reading properties is rather simple.  First,
bind to the item.  SHCreateItemFromIDList and SHCreateItemFromParsingName are appropriate for this.  Then read your
properties.  Be sure to clean up after yourself.

IShellItem2 *psi;
if
(SUCCEEDED(SHCreateItemFromParsingName(L"c:\tortoise.doc", NULL,
IID_IShellItem2, (void**)&psi)))
{
IPropertyStore
*pps;
if (SUCCEEDED(psi->GetPropertyStore(GPS_DEFAULT,
IID_IPropertyStore,
(void**)&pps)))
{
PROPVARIANT
propvar = {0};
if (SUCCEEDED(pps->GetValue(PKEY_Title,
&propvar)))
{
wprintf(L"Title:
%s\n", PropVariantToStringWithDefault(propvar,
L"<none>"));
PropVariantClear(&propvar);
}
pps->Release();
}
psi->Release();
}

Not bad for reading the title of a
document!  And I even checked the return results.

---

Constable Umer walked down the narrow flagstone path, then onto
cobblestones and finally gravel stones.  Turning a corner, Cons. Umer found
a door with a small card pinned to next to it.  "Great Flying Tortoise:
Purveyor of fine, proper teas."

Filed Under: Property System

Comments

No Comments

Anonymous comments are disabled

About benkaras
I have been a developer at Microsoft
for 3 years now. I primarily work on the property system and related areas.