Home   Index   About
Ultimate Pack


Custom Search
Storing Property Sets

Applications can expose some of the state of their documents so that other applications can locate and read that information. Some examples are a property set describing the author, title, and keywords of a document created with a word processor, or the list of fonts used in a document. This facility is not restricted to documents; it can also be used on embedded objects.

Note If you are storing a property set that is internal to your application, you might not want to follow the guidelines described below. If you want to expose your property set to other applications, you need to follow the guidelines.

To store a property set in a compound file:

  1. Create an IStorage or IStream instance in the same level of the storage structure as its data streams. Prepend the name of your IStorage or IStream instance with "\005." Stream and storage names that begin with 0x05 are reserved for common property sets that can be shared among applications. Also, streams beginning with that value are limited to 256Kb. The names can be selected from either published names and formats or by assigning the property set a FMTID and deriving the name from the FMTID according to the conventions described in the section "Naming Property Sets".

  2. A property set may be stored in a single IStream instance or in an IStorage instance containing multiple streams. In the case of an IStorage instance, the contained stream named "Contents" is the primary stream containing property values, where some values may be names of other streams or storage instances within the storage for this property set.

  3. Specify the CLSID of the object class that can display and/or provide programmatic access to the property values. If there is no such class, the the CLSID should be set to CLSID_NULL. For a property set that uses an IStorage instance, either set the CLSID of the IStorage instance to be the same as that stored in the Contents stream or to CLSID_NULL (the value in a newly created IStorage instance).

  4. You have the option of specifying displayable names that form the contents of the dictionary.

Some applications can read only implementations of property sets stored as IStream instances. Applications should be written to expect that a property set may be stored in either an IStorage or IStream instance, unless the property set definition indicates otherwise. For example, the Document Summary Information property set's definition says that it can only be stored in a named IStream instance. In cases where you are searching for a property set and you don't know whether it is a storage or stream, look for an IStream instance with your property set name first. If that fails, look for an IStorage instance.

To better understand storing property sets in an IStorage implementation, suppose there is a class of applications that edit information about animals. First, a CLSID (CLSID_AnimalApp) is defined for this set of applications so they can indicate that they understand property sets containing animal information (FormatID_AnimalInfo) and others containing medical information (FormatID_MedicalInfo).

IStorage (File): "C:\OLE\REVO.DOC"

IStorage: "\005AnimalInfo", CLSID = CLSID_AnimalApp

IStream: "Contents"

WORD dwByteOrder, WORD wFmtVersion, DWORD dwOSVer,

CLSID CLSID_AnimalApp, DWORD cSections...

...

FormatID = FormatID_AnimalInfo

Property: Type = PID_ANIMALTYPE, Type = VT_LPSTR, Value = "Dog"

Property: Type = PID_ANIMALNAME, Type = VT_LPSTR, Value = "Revo"

Property: Type = PID_MEDICALHISTORY, Type = VT_STREAMED_OBJECT,

Value = "MedicalInfo"

...

IStream: "MedicalInfo"

WORD dwByteOrder, WORD wFmtVersion, DWORD dwOSVer,

CLSID CLSID_AnimalApp, DWORD cSections...

...

FormatID = CLSID_MedicalInfo

Property: Type = PID_VETNAME, Type = VT_LPSTR, Value = "Dr. Woof"

Property: Type = PID_LASTEXAM, Type = VT_DATE, Value = ...

Note that the class IDs of the IStorage and both property sets is CLSID_AnimalApp. This identifies any application that can display and/or provide programmatic access to these property sets. Any application can read the information within the property sets (the point behind property sets), but only applications identified with the class ID of CLSID_AnimalApp can understand the meaning of the data in the property sets.


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun