<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Windows Portable Devices Team Blog : Autoplay</title><link>http://blogs.msdn.com/wpdblog/archive/tags/Autoplay/default.aspx</link><description>Tags: Autoplay</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Enabling Your WPD application for AutoPlay on Windows Vista</title><link>http://blogs.msdn.com/wpdblog/archive/2007/02/23/enabling-your-wpd-application-for-autoplay-on-windows-vista.aspx</link><pubDate>Fri, 23 Feb 2007 05:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1744998</guid><dc:creator>wpdblog</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/wpdblog/comments/1744998.aspx</comments><wfw:commentRss>http://blogs.msdn.com/wpdblog/commentrss.aspx?PostID=1744998</wfw:commentRss><description>&lt;p&gt;The power of WPD derives from built-in extensibility mechanisms and scenarios around content type and device function.&amp;nbsp; A good example is AutoPlay, which has been updated in Windows Vista to support WPD scenarios.&amp;nbsp;&amp;nbsp; Instead of providing the ability to only register for devices as a whole, AutoPlay now allows a generic scheme where each WPD device provides a list of content and functional categories that it supports.&amp;nbsp;&amp;nbsp; Application handlers can register for each type of content and function category that they are interested in.&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;b&gt;Overview of the WPD AutoPlay Registration Scheme&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The WPD AutoPlay&amp;nbsp;scheme is defined as follows:&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Source&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The list of content types in this group indicates what the device can provide.&lt;/li&gt;
&lt;li&gt;This allows for applications that are interested in browsing or acquiring device contents to be registered for devices that can provide that content.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;i&gt;Sink&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The list of content types in this group indicates what the device can accept.&lt;/li&gt;
&lt;li&gt;This allows for applications that are interested in putting content on the device to be registered for devices that can receive that content.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;i&gt;Function&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The list of categories in this group indicates what functions the device supports.&lt;/li&gt;
&lt;li&gt;This allows for applications that are interested in device functionality (e.g. ability to send/receive SMS messages) to be registered for devices that can provide that function.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Note that this scheme is not limited to the content the device currently has on its storage, but rather, &lt;b&gt;what the device is capable of storing/doing&lt;/b&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;When a device arrival event occurs, AutoPlay will walk the list of capabilities reported by the WPD driver (e.g. "Source for Audio"), and for each type found on the list, AutoPlay will walk the list of registered handlers to find a match.&amp;nbsp;&amp;nbsp;&amp;nbsp; The lists of handlers for the supported types are merged into a single list of handlers and presented to the user in the AutoPlay Dialog.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;b&gt;Registering Your WPD Application for AutoPlay&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;To register for WPD AutoPlay events, applications need to add themselves to the appropriate WPD entry under the AutoPlayHandlers\EventHandlers key.&amp;nbsp; To illustrate a simple application registration, suppose your WPD application can transfer Music to a WPD device, and can receive Music and Photos from a WPD device.&amp;nbsp;&amp;nbsp; You could register your application handler like this:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;[HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoPlayHandlers\EventHandlers\Wpd]:&lt;/p&gt;
&lt;p&gt;Sink &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {4AD2C85E-5E2D-45E5-8864-4F229E3C6CF0} &lt;i&gt;-&amp;gt; WPD_CONTENT_TYPE_AUDIO&lt;/i&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyWpdSendMusicHandler, REG_SZ, (Empty) &lt;/p&gt;
&lt;p&gt;Source &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {4AD2C85E-5E2D-45E5-8864-4F229E3C6CF0} &lt;i&gt;-&amp;gt; WPD_CONTENT_TYPE_AUDIO &lt;/i&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyWpdAcquirePhotoMusicHandler, REG_SZ, (Empty) &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {EF2107D5-A52A-4243-A26B-62D4176D7603} &lt;i&gt;-&amp;gt; WPD_CONTENT_TYPE_IMAGE &lt;/i&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyWpdAcquirePhotoMusicHandler, REG_SZ, (Empty) &lt;/p&gt;
&lt;p&gt;&lt;br&gt;Both [MyWpdAcquirePhotoMusicHandler] and [MyWpdSendMusicHandler] are normal Autoplay registrations in HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers.&amp;nbsp;&amp;nbsp; For more details, refer to this &lt;a href="http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/" class="" title="Autoplay in Windows XP" mce_href="http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/"&gt;MSDN article&lt;/a&gt; (suggested section: Autoplay V2 Registration Mechanism). &lt;/p&gt;
&lt;p&gt;The "EventHandlers\Wpd\..."&amp;nbsp;entries are defined using the content type and functional category &lt;b&gt;GUIDs&lt;/b&gt; (e.g. {EF2107D5-A52A-4243-A26B-62D4176D7603}), &lt;b&gt;not the symbolic names &lt;/b&gt;(i.e. WPD_CONTENT_TYPE_IMAGE).&amp;nbsp;&amp;nbsp; This is designed to support extensibility for custom content types and functional categories that devices and applications can register.&amp;nbsp; Published WPD GUID values and their associated symbolic names are defined in &lt;b&gt;PortableDevice.h&lt;/b&gt;, available in the Windows SDK.&lt;/p&gt;
&lt;p&gt;"Source" and "Sink" are content transfers &lt;b&gt;relative to the device, not the application&lt;/b&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp; In the example above, your application is registering for AutoPlay events for a WPD device that can do &lt;b&gt;one or more&lt;/b&gt; of the following: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Receive music content from your application&lt;/li&gt;
&lt;li&gt;Provide image or audio content to your application&amp;nbsp; &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;If your application is a general purpose WPD application that wants to register for any device, you can add a handler entry under the WPD_CONTENT_TYPE_ALL, e.g. in ...\Wpd\Source\{80E170D2-1055-4A3E-B952-82CC4F8A8689}.&amp;nbsp;&amp;nbsp; Note that this will also register your application to handle devices that support custom content types.&lt;br&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;AutoPlay for Functional Category&amp;nbsp;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Function registration provides a great way for your WPD application to register to handle devices that support specific commands or scenarios that are organized by functional category.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;For example, if your application interfaces with cameras that support image capture, register your handler for WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE, so that when a device that supports this functional category is connected, your app can be present&amp;nbsp;in the&amp;nbsp;AutoPlay dialog:&lt;/p&gt;
&lt;p&gt;[HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoPlayHandlers\EventHandlers\Wpd]:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {613CA327-AB93-4900-B4FA-895BB5874B79}&amp;nbsp;&amp;nbsp;-&amp;gt; &lt;i&gt;WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE&lt;/i&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;MyWpdImageCaptureHandler, REG_SZ, (Empty)&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;b&gt;Can I register AutoPlay for other device events? &lt;/b&gt;&lt;/p&gt;
&lt;p&gt;AutoPlay only supports registration for device arrival events.&amp;nbsp;&amp;nbsp; Your application can still receive WPD events and custom events using &lt;a href="http://msdn.microsoft.com/en-us/library/dd375684%28VS.85%29.aspx" title="IPortableDevice::Advise" mce_href="http://msdn.microsoft.com/en-us/library/dd375684(VS.85).aspx"&gt;IPortableDevice::Advise&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;b&gt;What about Windows XP? &lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The granular WPD Source/Sink/Function AutoPlay registration functionality is only available on Windows Vista.&amp;nbsp;&amp;nbsp; On Windows XP, the AutoPlay registration mechanisms are documented in this &lt;a href="http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/" class="" title="Autoplay in Windows XP" mce_href="http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/"&gt;MSDN article&lt;/a&gt; and in the MSDN library.&lt;/p&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;i&gt;This posting is provided "AS IS" with no warranties, and confers no rights.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1744998" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/wpdblog/archive/tags/SDK/default.aspx">SDK</category><category domain="http://blogs.msdn.com/wpdblog/archive/tags/Autoplay/default.aspx">Autoplay</category></item></channel></rss>