PRS310: Extending Explorer: Metadata Handlers, Live Icons

Download Report

Transcript PRS310: Extending Explorer: Metadata Handlers, Live Icons

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
3rd Party
Schemas
System
Schemas
Property Handlers
System Index
Media
Property
Handlers
Image
Property
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
Metadata
Handler
HRESULT GetCount([out] DWORD *cProps);
HRESULT GetAt(DWORD iProp, [out] PROPERTYKEY *pkey);
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
Property
System
IPropertyStore::GetValue()
Retrieve Property Values
Property
Handler
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 Miller”
Explorer
Property
System
Property
Handler
Open Metadata
p->SetValue(PKEY_Dog,
p->GetValue(PKEY_Dog)  ”
)
”
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
Property
Handler
IStream::Write
Stream-over-file
Underlying
File
Corrupted
Sad Panda
12
With Safe Save
IPropertyStore
IStream
IStream::Read
Safe-Save
Stream-over-file
IStream::Write
Property
Handler
IStream::Commit
Underlying
File
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
<configuration xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation= "allprops.xsd“ >
<propertyDescriptionList publisher = "Microsoft" product = "Windows” >
<propertyDescription name="System.Author"
formatId="F29F85E0-4FF9-1068-AB91-08002B27B3D9"
propertyId="4">
<typeInfo
type="String" multipleValues="true“ />
<search
index=“true” retrieve=“true” />
<displayInfo
drawControl=“Explorer.EditPropertyControl”
editControl=“Explorer.EditPropertyControl">
</displayInfo>
<labelInfo label="Author" invitationText="Add an author"
sortDescription="AToZ"/>
</propertyDescription>
<propertyDescriptionList/>
</configuration>
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.Size;etc
18
Custom Schemas
Try to use system properties:
Best behavior in heterogeneous sets;
e.g., Author, Photographer, Chef
Custom properties:
ISVName.ApplicationName.PropertyName
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
IInitializeWithStream
IThumbnailProvider
21
Thumbnail Provider Flow
IInitializeWithItem::Initialize
Initialize with IShellItem
Host
Vista Explorer
IThumbnailProvider::GetThumbnail()
or
3rd Party App Get thumbnail image
Thumbnail
Provider
22
Thumbnail Provider Services
Overlays
Adornments
Caching
Smooth Scaling
Preserves Aspect Ratio
Won’t 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:
IInitializeWithStream
IPreviewHandler
25
Previewing Architecture
IInitializeWithStream
Initialize from stream
IPreviewHandler::SetWindow
Pass in the window
IPreviewHandler::SetRect
Host
Vista Explorer
or
Outlook 12
Set the size of window
IPreviewHandler::DoPreview
Preview
Handler
Do preview
IPreviewHandler:SetRect
Resize when needed
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