Windows Vista: Extending Explorer By Providing Metadata, Rich Previews And Thumbnails For Your File Types Marc Miller PRS310 Development Lead Microsoft Corporation Agenda Extending Windows Vista Explorer Metadata Architecture Overview Exposing file properties with Metadata Handlers Extending the metadata schema Enabling Live Icons Creating Rich Previews
2 Why Extend Explorer? 3 Metadata Architecture Windows Explorer and 3rd Party Applications Property System Query System Indexer System Index 3rd Party Schemas
System Schemas Property Handlers Image Media Property Property Handlers Handlers 3rd Party Property Handlers File Formats File Formats
File Formats 4 Metadata Currency Property Names Canonical Names System.Author System.Photo.FNumber System.Music.Artist System.Groupname.Propertyname PROPERTYKEY struct PROPERTYKEY { GUID fmtid; DWORD propid; };
PKEY_Author, PKEY_FNumber, PKEY_Artist 5 Metadata Currency Property Values PROPVARIANT struct PROPVARIANT { VARTYPE vt; union { LPCWSTR pszVal; // VT_LPWSTR UINT uintVal; // VT_UI4 CALPWSTR calpwstr; // VT_VECTOR | VT_LPWSTR ... And more ...
}; }; Intrinsic (e.g. System.DateModified) Calculated (e.g. System.Kind) Handler 6 IPropertyStore Mapping PROPERTYKEYs to PROPVARIANT values IPropertyStore HRESULT GetCount([out] DWORD *cProps); HRESULT GetAt(DWORD iProp, [out] PROPERTYKEY *pkey);
Metadata Handler HRESULT GetValue(const PROPERTYKEY &key, [out] PROPVARIANT *pv); HRESULT SetValue(const PROPERTYKEY &key, const PROPVARIANT *pv); HRESULT Commit(); Enumerate Available Properties Retrieve Property Values Set Property Values 7 Consuming the Property System SHCreateItemFromName() API IShellItem
GetPropertyStore() Shell Item Object IPropertyStore Property System System Schemas 3rd Party Schemas Intrinsic & Calculated Properties Property Store IPropertyStore
Handler-provided Properties Property Handler 8 Property Store Data Flow IInitializeWithStream::Initialize Initialize with stream IPropertyStore::GetCount() IPropertyStore::GetAt(i) Enumerate Available Properties Explorer
IPropertyStore::GetValue() Property Property Handler System Retrieve Property Values IPropertyStore::SetValue() Set Property Values IPropertyStore::Commit() Commit Changes 9 IPropertyStore Guidelines Characteristics of a good implementation Round-Tripping p->SetValue(PKEY_Author, Marc Miller)
p->GetValue(PKEY_Author) Marc MillerMarc MillerMarc Miller Explorer Property System Property Handler Open Metadata p->SetValue(PKEY_Dog, p->GetValue(PKEY_Dog) Marc Miller )
Marc Miller 10 IPropertyStore Services Helpers available to IPropertyStore implementers Fallback IPropertyStore Property Cache (IPropertyStoreCache) Property Store Serialization Property Store Capabilities Safe Save 11 Without Safe Save
IPropertyStore IStream IStream::Read Stream-over-file Underlying File Property Handler IStream::Write Corrupted Sad Panda 12
With Safe Save IPropertyStore IStream IStream::Read Safe-Save Stream-over-file Underlying File IStream::Write Property Handler IStream::Commit
Temporary File 13 Providing Content 3 ways to provide content Property Handlers (IPropertyStore) File formats Metadata Some full-text content Property Handlers + IFilters (Full-text)
File formats Metadata Extensive full-text content, multi-lingual Protocol Handlers + Shell Folders Non-file system based stores Metadata Extensive full-text content, multi-lingual 14 Implementing
IPropertyStore 15 Property Descriptions
16 Property Description APIs SHGetPropertyDescription() API IPropertyDescription System Schemas
3rd Party Schemas Property Provider Layer GetType() GetCanonicalName() GetEditControl() GetUILabel() Etc 17
Property Description Lists ex: prop:System.DisplayName;System.Author;System.Si 18 ze;etc Custom Schemas Try to use system properties: Best behavior in heterogeneous sets; e.g., Author, Photographer, Chef Custom properties: ISVName.ApplicationName.PropertyNam e Create your own PROPERTYKEYs Install your own .propdesc file
Install using SHInstallSchema() API Register your prop: strings 19 Custom Schemas 20 Live Icons Large 256x256 Rich 32bpp bit depth. Live Screenshot of
actual contents. Visual Treatments Drop Shadows Type Overlays New & simpler API IInitializeWithStre am 21 Thumbnail Provider Flow IInitializeWithItem::Initialize Initialize with IShellItem
Host Thumbnail Vista Explorer IThumbnailProvider::GetThumbnail() Provider or 3rd Party AppGet thumbnail image 22 Thumbnail Provider Services Overlays Adornments Caching Smooth Scaling Preserves Aspect Ratio
Wont scale-up Automatically displays icon PKEY_Thumbnail 23 Thumbnail Provider 24 Providing Rich Preview Handlers Interactive Read-only contents view Text highlighting. Light-weight
Same code runs in: Vista Explorer, Outlook 12, Common File Dialog. Implement: IInitializeWithStrea m 25 Previewing Architecture IInitializeWithStream Initialize from stream IPreviewHandler::SetWindow
Pass in the window Host IPreviewHandler::SetRect Set the size of window Vista Explorer or Do preview Outlook 12 IPreviewHandler::DoPreview Resize when needed Preview
Handler IPreviewHandler:SetR ect IPreviewHandler::Unload Unload Process Boundary 26 Guidelines Previewing is read-only Minimal UI Support Base Functionality Light-weight with fast start-up time Security and Privacy
Support accelerators and context menu 27 Rich Previews 28 Explorer Extensibility Futures Command Bar Extensibility Per file-type Per type-hierarchy Custom Explorer Modules Custom Explorer Templates
Pluggable Query Providers Your feedback needed! 29 Call To Action Providing best experience for your file formats Determine which System schemas to use Introduce custom schemas if needed Build a property handler Define property lists, virtual folders Build a Live Icon provider (Beta2) Build a rich Previewer (Beta2) 30
Other Resources PDC Talks DAT307 Windows Vista: Exploiting New Capabilities for Search and Organization OFF320 Developing with Microsoft Office System Search Technology DAT322 MSN Search: Building Web and Desktop Search into Your Applications ILL02 Enhancing your Win32 Application for Windows Vista Presentation Track Lounge MSDN Forum: Data Access, Storage, Search and Organize in Windows Vista channel9.msdn.com: Windows Vista Shell blogs.msdn.com/marcmill 31
2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 32