<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://windowsteamblog.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 7 for Developers</title><link>http://windowsteamblog.com/blogs/developers/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>Windows7 Trigger Start Services – Part 2: Building a Trigger Start Optimized Service</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/27/windows7-trigger-start-services-part-2-building-a-trigger-start-optimized-service.aspx</link><pubDate>Wed, 28 Oct 2009 00:13:21 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:527328</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=527328</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/27/windows7-trigger-start-services-part-2-building-a-trigger-start-optimized-service.aspx#comments</comments><description>&lt;p&gt;In the last post &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/26/windows7-trigger-start-services-part-1-introduction.aspx"&gt;Windows 7 Trigger Start Services – Part 1: Introduction&lt;/a&gt;, we introduced Windows7 Trigger Services as a great way to optimize your services to have better performance and improved security. In this post you will learn how to convert a standard automatic-start service to a trigger-start service that starts up only when a certain event occurs in the system. We’ll use a WPF application (obviously managed code) that registers and monitors a service (also implemented using .NET). To bridge between the .NET world and the native Win32 APIs that we saw in the previous post, we use a C++/CLI interoperability layer. &lt;/p&gt;  &lt;p&gt;This sample application has 3 parts:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A C++/CLI interoperability layer that provides a regular and easy .NET API to the controller application &lt;/li&gt;    &lt;li&gt;A WPF controller application that lets you register and run the service &lt;/li&gt;    &lt;li&gt;A simple .NET service that looks for a USB storage device (disk on key) and on it, a specific folder named “&lt;i&gt;ToCopy&lt;/i&gt;” from which to copy files to your local “&lt;i&gt;C:\FromUSB&lt;/i&gt;” folder &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The following image illustrates the solution structure.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_5FB98C22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_5EE12638.png" width="217" height="373" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Let’s start by reviewing the .NET Service code implementation. This is a simple Windows service written in C#. The purpose of this service is to copy pictures automatically to your local hard-drive- “&lt;i&gt;c:\FromUSB&lt;/i&gt;” from the USB storage device that is plugged into your computer. &lt;/p&gt;  &lt;p&gt;The service implementation can be found at &lt;i&gt;USBService.cs&lt;/i&gt;. This class inherits the ServiceBase base class and overrides the &lt;i&gt;OnStart&lt;/i&gt; and &lt;i&gt;OnStop&lt;/i&gt; methods. This class has a &lt;i&gt;DoWork&lt;/i&gt; method that actually does all the copying of images from the USB disk to your local drive. The &lt;i&gt;DoWork&lt;/i&gt; method writes to a log file that we will be monitoring. &lt;/p&gt;  &lt;p&gt;The real interesting part of the service implementation is the &lt;i&gt;OnStart&lt;/i&gt; method. This method is called once the service is started. Notice that the first line of code checks whether the service is configured as a trigger start service. If the “if” statement returns false, we create a new instance of a timer and have it poll every 5 seconds. &lt;b&gt;Before&lt;/b&gt; Windows7, this was the only way to implement such a service, that is, by regularly polling the system to check for a USB device. Therefore, the service needs to run 24x7 to poll the system. This is highly wasteful of resources and keeps the system from transitioning to a low-power state, increases the application attack surface, among other negative things.&lt;/p&gt;  &lt;p&gt;But, with Windows7, you can configure such a service with a USB device arrival trigger. This means that the service will not run until a USB device arrives, specifically a USB generic disk device. We’ll get to that part of the solution in a second, but for now, if you look at the &lt;i&gt;OnStart&lt;/i&gt; method, you will notice that we check whether the service is configured as a trigger start service; if it is, we simply call the &lt;i&gt;DoWork&lt;/i&gt; method on another thread, as shown by the following code snippet. This should work just fine because the service is NOT running, and will start to run only when the trigger happens. And then it will not default to the timer, but rather use the thread pool to queue the work.&lt;/p&gt;  &lt;pre class="csharpcode"&gt; &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnStart(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
 {
   &lt;span class="kwrd"&gt;if&lt;/span&gt; (ServiceControl.IsServiceTriggerStart(ServiceName))
   {
      ThreadPool.QueueUserWorkItem(_ =&amp;gt; DoWork());
   }
   &lt;span class="kwrd"&gt;else&lt;/span&gt;
   {
     _timer = &lt;span class="kwrd"&gt;new&lt;/span&gt; Timer(_ =&amp;gt; DoWork());
     _timer.Change(0, 5000);
   }
 }&lt;/pre&gt;

&lt;p&gt;The &lt;i&gt;ServiceControl&lt;/i&gt; namespace contains the C++/CLI interop layer. This layer uses C++/CLI as the binding element between the native API and the WPF application. The main ServiceControlInterop.cpp file contains all the functionality that we need and that is used by the WPF application. For example using the controller application we can use &lt;i&gt;AddService(…) &lt;/i&gt;or&lt;i&gt; RemoveService(…)&lt;/i&gt; to add or remove a service respectively. We can also configure the service as a trigger start service for either a USB device arrival or first available IP address by using &lt;i&gt;SetServiceTriggerStartOnUSBArrival&lt;/i&gt; or &lt;i&gt;SetServiceTriggerStartOnIPAddressArrival &lt;/i&gt;respectively. Reviewing both function implementations reveals that basically both are following identical paths. They:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;First, use &lt;em&gt;OpenSCManager&lt;/em&gt; to get a handle to the Service Control Manager (SCM) &lt;/li&gt;

  &lt;li&gt;Then use the SCM handle &lt;em&gt;OpenService&lt;/em&gt;, to get an actual service handle that we wish to configure &lt;/li&gt;

  &lt;li&gt;Finally call &lt;em&gt;ChangeServiceConfig2&lt;/em&gt; to set the specific trigger &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All this was explained in detail in the last post (&lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/26/windows7-trigger-start-services-part-1-introduction.aspx"&gt;Windows7 Trigger Start Services – Part 1: Introduction&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples/TriggerStartServiceDemo.zip"&gt; download&lt;/a&gt; the code sample for this application. Note that you will have to run Visual Studio as administrator (see image below) because you will need to register, start, and stop services. . You will also need to Windows 7 SDK to compile the C++ part of the solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_49173DDB.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_2F4307AC.png" width="331" height="184" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;When compiling and running the default solution (the WPF application) you will see the following image. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_156ED17D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_34B17850.png" width="258" height="286" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This is the main WPF controller application. From here, you can create the service by clicking the Create Manual button.&lt;/p&gt;

&lt;p&gt;Next, open the Services Window by typing “Services” in the Start Menu search box. You should see the Service window. Locate the USBCopyService; it should appear as in the following image.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_2606CC6B.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_336CDF71.png" width="524" height="132" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Click the Run button and then the Refresh button in the Services window, or just press F5. You will not notice a great deal of change, but the USBCopyService changed from Manual to Started, as shown in the following image.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_2BE17004.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_0B5A3052.png" width="514" height="110" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;A second look at the actual application reveals the service activity in the log file. As you can see in the following image, the services awaken every 5 seconds and poll the system, looking for USB devices:&lt;/p&gt;
&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_18C04358.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_29C4713B.png" width="307" height="340" /&gt;&lt;/a&gt; 

&lt;p&gt;Click the Stop button to stop the service and then click the Delete Service to delete it. Now click the Trigger Start button to register and configure the service as a trigger start service that is triggered once a USB Generic disk arrives. If you check the Service window, you will see the USBCopyService listed as “manual” where in reality it is configured as triggered start service (there is just no graphical representation of that). &lt;/p&gt;

&lt;p&gt;If you plug in a USB disk with a “ToCopy” folder the service will kick into action and copy the files to c:\FromUSB. Not the best implementation, but hey, it is only a demo. The following image shows a single line in the log file because the service actually ran only once; it executed the &lt;i&gt;DoWork&lt;/i&gt; method and then quit. It didn’t run and poll the system every 5 seconds and didn’t waste resources or become a security liability.&lt;/p&gt;
&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_3AC89F1E.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_4EE1BBA7.png" width="335" height="372" /&gt;&lt;/a&gt; 

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;To conclude &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Developing a service with Windows 7 trigger start service in mind might be a little more difficult than a regular “auto-run” service that just runs in idle from boot to shutdown. But in practice, all it takes is only a few lines of code, no more. And these few lines of code can have a very big affect in terms of resource consumption and security. So the next time you build a new Windows Service, try to incorporate triggers.&lt;/p&gt;

&lt;p&gt;You can learn about Windows 7 using the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=1C333F06-FADB-4D93-9C80-402621C600E7&amp;amp;displaylang=en"&gt;Windows 7 Training Kit for Developers&lt;/a&gt; or by viewing Windows 7 videos on &lt;a href="http://channel9.msdn.com/windows"&gt;Channel 9&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also get &lt;a href="http://channel9.msdn.com/learn/courses/Windows7/BackgroundServices/"&gt;hands-on&lt;/a&gt; experience for Windows 7 Trigger Start Services using the &lt;a href="http://channel9.msdn.com/learn/courses/Windows7/"&gt;Windows 7 Online training&lt;/a&gt; that is part of the &lt;a href="http://channel9.msdn.com/learn/"&gt;Channel 9 Learning Center&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=527328" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Trigger+Start+Services/default.aspx">Trigger Start Services</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Performance/default.aspx">Performance</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Trigger+Start+Services/default.aspx">Windows 7 Trigger Start Services</category></item><item><title>Windows7 Trigger Start Services – Part 1: Introduction</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/26/windows7-trigger-start-services-part-1-introduction.aspx</link><pubDate>Mon, 26 Oct 2009 18:42:17 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:527263</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>19</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=527263</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/26/windows7-trigger-start-services-part-1-introduction.aspx#comments</comments><description>&lt;p&gt;We introduced &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/01/session-0-isolation.aspx"&gt;Service 0 Isolation&lt;/a&gt; a few weeks ago as an application compatibility topic. It is only natural that we continue our conversation about services in the context of Windows 7. But this time, we will talk about some of the benefits to service optimization that are available in Windows 7. This post focuses on a new feature in Windows 7 called &lt;b&gt;Trigger Start Services&lt;/b&gt;. But before we jump into the API, let’s provide some background about services.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;What Are Services?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;A service is an integral mechanism built into Microsoft Windows operating systems. You can think of services as “special applications” that run with no regard to the current user context. Services are different from “regular” user applications because you can configure a service to run from the time a system starts up (boots) until it shuts down, without requiring an active user to be present – that is, services can run even though no users are logged on. &lt;/p&gt;  &lt;p&gt;We like to think about services as running tasks for us in the background without interfering with user operations. Services on Windows are responsible for all kinds of background activity that do not involve the user, ranging from the Remote Procedure Call (RPC) service, through Printer Spoolers, to the Network Location Awareness service.&lt;/p&gt;  &lt;p&gt;Over the years, Windows has grown and with it the number background services. But to be honest, background services in Windows are a pain – the operating system ships with a lot of them in the box. On top of that, ISVs and their applications add even more services, like software updates to name only one. With that said, some of these services are critical and are required during boot sequences, some are required later when a specific user logs on, while others don’t need to execute until they are called upon. Nonetheless, when you look at the currently running services, you see &lt;b&gt;a lot&lt;/b&gt; of services that really don’t need to run 24x7.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;What’s Wrong with Services Running 24x7?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;There are several issues with having services run 24x7:&lt;/p&gt;  &lt;p&gt;First, why have something run (even in the background) when there is no need for it to run? Any running process (services included) uses valuable memory and CPU resources that could be used by other applications and services. If you total up all the services that are running at any given time, they add up to quite a lot of memory, handles, threads, and plenty of CPU usage. All of these “wasted” resources reduce the overall computer performance, decrease its responsiveness, and make users think their computers are sluggish and slow. Also, since most of the running services are configured as Auto-Start (start running upon system log-on), these services have an impact on the computer's boot time.&lt;/p&gt;  &lt;p&gt;Second, these wasted resources, have a direct impact on power consumption. The more demands we place on the CPU, the more power our computer uses. This can be critical for laptops, and could reduce battery life from four hours to three hours.&lt;/p&gt;  &lt;p&gt;Third, having non-productive software run all the time may lead to memory leaks and overall system instability. This can lead to application crashes and ultimately computer crashes.&lt;/p&gt;  &lt;p&gt;Last, but not least, if a service is running 24x7, and this services is well known (any popular application might have one – like the PDF Reader), it provides a larger attack surface. A hacker might use the knowledge that a certain popular application installs a service that runs 24x7, and try to hack into that service to gain privileged access to the computer. &lt;/p&gt;  &lt;p&gt;Given all of the above, it makes you wonder why so many developers configure their services to run all the time when there are other options. Even before Windows 7, there were several service start-up options:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Disabled&lt;/b&gt; completely disables the service and prevents it and its dependencies from running—this means that the user must start the service manually from the Control Panel or the command line&lt;/li&gt;    &lt;li&gt;&lt;b&gt;Manual&lt;/b&gt; starts a service as required (defined by dependencies to other services) or when called from an application using the relevant API as shown later in this post&lt;/li&gt;    &lt;li&gt;&lt;b&gt;Automatic&lt;/b&gt; starts the services at system logon&lt;/li&gt;    &lt;li&gt;&lt;b&gt;Automatic&lt;/b&gt; &lt;b&gt;Delayed&lt;/b&gt; is a newer startup type introduced in Windows Vista that starts the service after the system has finished booting and after initial demanding operations have completed, so that the system boots up faster&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Unfortunately, many ISVs (Microsoft included) still choose to configure their services to Automatic (or Automatic Delayed) because it is the easy solution for everyone. A service simply runs 24x7 and is always available, eliminating the need to check any dependencies or verify that the service is running.&lt;/p&gt;  &lt;p&gt;There are many examples of existing services that can become more resource friendly and more secure by not running 24x7. For example, think of an update service that checks for new application updates. If the computer is not connected to a network and has no IP available, why should the update service run? It can't reach anywhere, so why run a program that does nothing? Think about a policy management service that is invoked when a group policy changes or when the computer joins or leaves a domain, but right now the computer is connected to my home network and again the service works in vain. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Introducing Windows 7 Trigger Start Services&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The solution for the above problems is to move the service out of its “forever running state” into other types of background activity, such as scheduled tasks or trigger-start services. This post focuses on Windows 7 Trigger Start Services. Windows 7 Scheduled Tasks include a lot of valuable information that we will describe in another post. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd405513(VS.85).aspx"&gt;Trigger-start services&lt;/a&gt; are new to Windows7. A trigger-start service is a regular service that you can configure to run (or stop running) only when it is triggered, that is, only when certain criteria and conditions that you define are met (for example, when the first network IP address becomes available, or when the last network IP is lost). Here is a list of the available triggers that you can use to configure the Start-Up mode of a given service:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Device interface arrival or departure&lt;/li&gt;    &lt;li&gt;Joining or leaving a domain&lt;/li&gt;    &lt;li&gt;Opening or closing a firewall port&lt;/li&gt;    &lt;li&gt;Group policy change&lt;/li&gt;    &lt;li&gt;First IP address available/ last IP address leaving&lt;/li&gt;    &lt;li&gt;Custom event – Event Tracing for Windows (ETW)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The last item in the list represents the extendibility point. As a developer, you can configure any ETW event as a trigger for services, which gives you a very good tool to fine-tune your control over starting and stopping services from your application.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;So what exactly is a trigger? &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;A trigger consists of:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A trigger event type&lt;/li&gt;    &lt;li&gt;A trigger event subtype&lt;/li&gt;    &lt;li&gt;The action to be taken in response to the trigger event&lt;/li&gt;    &lt;li&gt;One or more trigger-specific data items (for certain trigger event types) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The subtype and the trigger-specific data items together specify the conditions for notifying the service of the event. The format of a data item depends on the trigger event type; a data item can be made up of binary data, a string, or a multistring. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Working with Trigger Start Services&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Unfortunately, Windows 7 Services MMC UI does not include a graphical representation of the trigger start services. However, you have two options. You can still use the old and good sc.exe (Service Configuration command line tool), or you can use the WIN32 &lt;a href="http://msdn.microsoft.com/en-us/library/ms681988(VS.85).aspx"&gt;ChangeServiceConfig2&lt;/a&gt; method to configure the service start option programmatically as demonstrated in this post. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Using &lt;i&gt;SC.exe&lt;/i&gt; to Query Service Trigger Information &lt;i&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;It's time to start have some fun. First, let’s start with just extracting some configuration information from a few services. The generic form for using the service configuration is:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;sc &amp;lt;server&amp;gt; [command] [service name] &amp;lt;option1&amp;gt; &amp;lt;option2&amp;gt;...&lt;/pre&gt;
Where &lt;em&gt;server &lt;/em&gt;is optional and by default you work with the local computer:&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;command&lt;/b&gt; is the operation you wish to perform like querying trigger information&lt;/li&gt;

  &lt;li&gt;&lt;b&gt;service name &lt;/b&gt;is the name of the service you wish to work with&lt;/li&gt;

  &lt;li&gt;&lt;b&gt;options&lt;/b&gt; are the different values (options) you can pass to configure the service&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s start by querying a specific service for its trigger start configuration. To do so you need to launch a Windows Shell window:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open the start menu.&lt;/li&gt;

  &lt;li&gt;Type CMD in the search box. &lt;/li&gt;

  &lt;li&gt;Choose cmd.exe.
    &lt;br /&gt;This will open a Windows Shell window.&lt;/li&gt;

  &lt;li&gt;Type &lt;strong&gt;sc qtriggerinfo w32time&lt;/strong&gt; and press enter&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is how it should look:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_64AEB689.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_35E8FDE7.png" width="564" height="141" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As you can see, we queried the trigger information of the W32time service, which is configured to start when the computer is joined to a domain and stop when the computer leaves the domain.&lt;/p&gt;

&lt;p&gt;Microsoft updated the sc.exe command-line tool for Windows 7 to support configuring and querying a service for supported triggers. Type sc triggerinfo in the Windows shell window and press enter. The result looks like the box below, and lists all the different triggers and how to configure a service to use trigger start services. &lt;/p&gt;

&lt;pre class="csharpcode"&gt;C:\&amp;gt;sc triggerinfo
DESCRIPTION:
        Changes the trigger parameters of a service.
USAGE:
        sc &amp;lt;server&amp;gt; triggerinfo [service name] &amp;lt;option1&amp;gt; &amp;lt;option2&amp;gt;...
OPTIONS:
 start/device/UUID/HwId1/... &amp;lt;Start the service on arrival of the
                             specified device interface class UUID
                             string with one or more hardware ID
                             strings and/or compatible ID strings&amp;gt;
 start/custom/UUID/data0/.. &amp;lt;Start the service on arrival of an
                             event from the specified custom ETW
                             provider UUID string with one or more
                             binary data items as hexadecimal
                             string format such as ABCDABCD to
                             set 4 byte data&amp;gt;
 stop/custom/UUID/data0/... &amp;lt;Stop the service on arrival of an
                             event from the specified custom ETW
                             provider UUID string with one or more
                             binary data items as hexadecimal
                             string format such as ABCDABCD to
                             set 4 byte data&amp;gt;
 start/strcustom/UUID/data0/.. &amp;lt;Start the service on arrival of an
                             event from the specified custom ETW
                             provider UUID string with one or more
                             optional string data items&amp;gt;
 stop/strcustom/UUID/data0/.. &amp;lt;Stop the service on arrival of an
                             event from the specified custom ETW
                             provider UUID string with one or more
                             optional string data items&amp;gt;
 start/networkon             &amp;lt;Start the service on first IP address&amp;gt;
 stop/networkoff             &amp;lt;Stop the service on zero IP addresses&amp;gt;
 start/domainjoin            &amp;lt;Start the service on domain join&amp;gt;
 stop/domainleave            &amp;lt;Stop the service on domain leave&amp;gt;
 delete                      &amp;lt;Delete the existing trigger parameters&amp;gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;For example, to configure a service to start when the first IP address becomes available, all you need to do is type &lt;em&gt;sc triggerinfo [your service name] start/networkon&lt;/em&gt;, where “your service name” is replaced with the name of the service that you wish to configure.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Configuring Trigger Start Services Programmatically Using &lt;i&gt;ChanceServiceConfig2&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The more interesting aspect, from a developer's point of view, is writing services that are trigger aware and using code to configure a service. In Windows 7, you can use the &lt;b&gt;ChangeServiceConfig2&lt;/b&gt; function to configure service trigger information and the &lt;b&gt;QueryServiceConfig2&lt;/b&gt; function to query it. &lt;/p&gt;

&lt;p&gt;Service trigger registration is performed by calling &lt;b&gt;ChangeServiceConfig2&lt;/b&gt;, passing SERVICE_CONFIG_TRIGGER_INFO for the &lt;i&gt;dwInfoLevel&lt;/i&gt; parameter, and providing the trigger registration information in a SERVICE_TRIGGER_INFO structure through the &lt;i&gt;lpInfo&lt;/i&gt; parameter. In addition, one or more trigger-specific data items can be specified. The following is an example of a service installer function that creates a USB device trigger for a service that is named &lt;i&gt;MyService&lt;/i&gt;:&lt;/p&gt;

&lt;div&gt;
  &lt;pre id="codeSnippet" class="csharpcode"&gt;define SERVICE_NAME L&lt;span class="str"&gt;&amp;quot;MyService&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;//set the device guid&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;const&lt;/span&gt; GUID GUID_USBDevice = {&lt;br /&gt;       0x53f56307, 0xb6bf, 0x11d0, &lt;br /&gt;       {0x94, 0xf2, 0x00, 0xa0, 0xc9, &lt;br /&gt;       0x1e, 0xfb, 0x8b }};&lt;br /&gt;&lt;br /&gt;BOOL _SetServiceToStartOnDeviceTrigger()&lt;br /&gt;{&lt;br /&gt;    BOOL fResult = &lt;span class="kwrd"&gt;FALSE&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;    SC_HANDLE hScm = OpenSCManager(&lt;br /&gt;        NULL, &lt;span class="rem"&gt;//local machine&lt;/span&gt;&lt;br /&gt;        NULL, &lt;span class="rem"&gt;//active database&lt;/span&gt;&lt;br /&gt;        SC_MANAGER_CONNECT);&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt;(hScm != NULL)&lt;br /&gt;    {&lt;br /&gt;        SC_HANDLE hService = OpenService(&lt;br /&gt;            hScm,&lt;br /&gt;            SERVICE_NAME,&lt;br /&gt;            SERVICE_ALL_ACCESS);&lt;br /&gt;&lt;br /&gt;        If( hService != NULL)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;           LPCWSTR lpszDeviceString = L&lt;span class="str"&gt;&amp;quot;USBSTOR\\GenDisk&amp;quot;&lt;/span&gt;;&lt;br /&gt;           SERVICE_TRIGGER_SPECIFIC_DATA_ITEM deviceData = {0};&lt;br /&gt;           deviceData.dwDataType = SERVICE_TRIGGER_DATA_TYPE_STRING;&lt;br /&gt;           deviceData.cbData = &lt;br /&gt;                       (wcslen(lpszDeviceString)+1) * &lt;span class="kwrd"&gt;sizeof&lt;/span&gt;(WCHAR);    &lt;br /&gt;           deviceData.pData = (PBYTE)lpszDeviceString;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;           &lt;br /&gt;           SERVICE_TRIGGER st;&lt;br /&gt;           st.dwTriggerType = &lt;br /&gt;                       SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL;&lt;br /&gt;           st.dwAction = SERVICE_TRIGGER_ACTION_SERVICE_START;&lt;br /&gt;           st.pTriggerSubtype = (GUID *) &amp;amp;GUID_USBDevice;&lt;br /&gt;           st.cDataItems = 1;&lt;br /&gt;           st.pDataItems = &amp;amp;deviceData;&lt;br /&gt;&lt;br /&gt;           &lt;br /&gt;           SERVICE_TRIGGER_INFO sti;&lt;br /&gt;           sti.cTriggers = 1;&lt;br /&gt;           sti.pTriggers = &amp;amp;st;&lt;br /&gt;           sti.pReserved = 0;&lt;br /&gt;&lt;br /&gt;           fResult = ChangeServiceConfig2(&lt;br /&gt;                        hService,&lt;br /&gt;                        SERVICE_CONFIG_TRIGGER_INFO,&lt;br /&gt;                        &amp;amp;sti);&lt;br /&gt;        }&lt;br /&gt;        CloseServiceHandle (hService);&lt;br /&gt;    }&lt;br /&gt;    CloseServiceHandle (hScm);&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt;(!fResult)&lt;br /&gt;    {&lt;br /&gt;        printf(&lt;span class="str"&gt;&amp;quot;Service trigger registration failed (%d)\n&amp;quot;&lt;/span&gt;, &lt;br /&gt;                 GetLastError());&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; fResult;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;Note: all services are controlled by the Service Control Manager (SCM), which we’ll touch on in a different post.&lt;/div&gt;

&lt;div&gt;
  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;In the above code snippet, you can see that first we get a handle (hScm) to the SCM by calling &lt;i&gt;openSCManager&lt;/i&gt;. Next, we call &lt;i&gt;openService&lt;/i&gt; and pass the handle to the SCM- hscm,and the service name – SERVICE_NAME that we wish access. The last parameter, SERVICE_ALL_ACCESS, indicates that we have complete access to the services. Assuming we got a valid handle to the service, we now start to build the specific structure that we’ll soon use to configure the service. &lt;/p&gt;

&lt;p&gt;SERVICE_TRIGGER_SPECIFIC_DATA_ITEM defines the trigger event type. It contains trigger-specific data for the service trigger event. In our case we define the string that represents a USB gen disk arrival. &lt;/p&gt;

&lt;p&gt;Next we define the SERVICE_TRIGGER structure, which represents a service trigger event. Note that this is where we define the trigger type (device arrival), the action (start the service), and the trigger sub type (the specific family of the USB device). Then we define one device that will trigger the service. Note that you can define an array of devices and their GUIDs. You should also note that we don’t want the service to be triggered upon just any USB device arrival like a mouse or a camera. We want the service to start only when a USB disk arrives. &lt;/p&gt;

&lt;p&gt;Finally, we define the SERVICE_TRIGGER_INFO structure, which contains trigger event information for a service. This structure simply points to the SERVICE_TRIGGER struct that we defined previously, and the number of triggers that, in this case, is one. &lt;/p&gt;

&lt;p&gt;Now we can call the ChanceServiceConfig2 function and pass the handle to the service we wish to configure, a SERVICE_CONFIG_TRIGGER_INFO parameter that indicates that we wish to configure the service trigger, and a null. &lt;/p&gt;

&lt;p&gt;That is all there is to it. If we are successful, then our service will run after we insert a USB hard drive.&lt;/p&gt;

&lt;p&gt;In the next post, we'll review how to write a simple implementation of a .NET service that we’ll program to start upon arrival of a USB generic disk. &lt;/p&gt;

&lt;p&gt;You can learn about Windows 7 using the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=1C333F06-FADB-4D93-9C80-402621C600E7&amp;amp;displaylang=en"&gt;Windows 7 Training Kit for Developers&lt;/a&gt; or by viewing Windows 7 videos on &lt;a href="http://channel9.msdn.com/windows"&gt;Channel 9&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also get &lt;a href="http://channel9.msdn.com/learn/courses/Windows7/BackgroundServices/"&gt;hands-on&lt;/a&gt; experience for Windows 7 Trigger Start Services using the &lt;a href="http://channel9.msdn.com/learn/courses/Windows7/"&gt;Windows 7 Online training&lt;/a&gt; that is part of the &lt;a href="http://channel9.msdn.com/learn/"&gt;Channel 9 Learning Center&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=527263" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Channel+9/default.aspx">Channel 9</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Labs/default.aspx">Labs</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Triger+Start+Services/default.aspx">Triger Start Services</category></item><item><title>Windows 7 GA – Time for Some New Windows 7 Developer Resources</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/22/windows-7-ga-time-for-some-new-windows-7-developer-resources.aspx</link><pubDate>Fri, 23 Oct 2009 00:08:53 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:527063</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=527063</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/22/windows-7-ga-time-for-some-new-windows-7-developer-resources.aspx#comments</comments><description>&lt;p&gt;Windows 7 is now available to the public and anyone can buy and install Windows 7, whether for a new computer or an existing one. Soon, people from around the world will run your applications on Windows 7. They will expect the application to work and to feel as though it is a native Windows 7 application that takes advantage of new Windows 7 features and technologies like the Taskbar, libraries, touch, and sensors. &lt;/p&gt;  &lt;p&gt;As Windows 7 approached GA, we continued to release new developer content to help you get up to speed with the new operating system. Now that it's here, Windows 7 GA is a great “excuse” for us to give you a quick update on all the Windows 7 developer content that is available to help you learn how to write a great Windows 7 application. &lt;/p&gt;  &lt;p&gt;Below is a list of locations where you can find Windows 7 developer content.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Updated Windows 7 Training&lt;/b&gt;&lt;b&gt; Kit&lt;/b&gt; – (&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1c333f06-fadb-4d93-9c80-402621c600e7&amp;amp;displaylang=en"&gt;Download it now&lt;/a&gt;)&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="20" width="580"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="290"&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1c333f06-fadb-4d93-9c80-402621c600e7&amp;amp;displaylang=en" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_4AF2B9BF.png" width="276" height="256" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="290"&gt;To help you get your application onto Windows 7 as soon as possible, we updated the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1c333f06-fadb-4d93-9c80-402621c600e7&amp;amp;displaylang=en"&gt;&lt;b&gt;Windows 7 Training Kit for Developers&lt;/b&gt;&lt;/a&gt;. You can still find all the previous topics such as Taskbar, Sensor and Location, Libraries and Shell, Multitouch, Ribbon, etc. New to the kit are labs that work with VS2010 and use the new MFC improvements in VS2010 (&lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;download VS2010&lt;/a&gt;). We also added VB to all of our managed solutions – truly, no developer is left behind.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Windows 7 Online Training on Channel 9 Learning Center&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Let’s assume you are interested in learning about Windows 7 libraries, or how to add some cool Taskbar functionality to your application, but you don’t want to download the entire training kit. Well with the &lt;a href="http://channel9.msdn.com/learn/courses/Windows7"&gt;Windows 7 Online Training Kit&lt;/a&gt; located on the &lt;a href="http://channel9.msdn.com/learn/"&gt;Channel 9 Learning Center&lt;/a&gt;, you have immediate access to all Windows 7 learning units individually. Each learning unit (like the Taskbar) includes a few hands-on-labs and related videos. This gives you quick and easy access to most of our training material. For the rest of the content, like PowerPoint presentations and additional demos, you will have to &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1c333f06-fadb-4d93-9c80-402621c600e7&amp;amp;displaylang=en"&gt;download the Windows 7 Training Kit for Developers&lt;/a&gt;. The following image shows part of the managed code hands-on-lab for the Taskbar.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/learn/courses/Windows7" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_42FB175D.png" width="563" height="316" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As always, the Windows 7 Topic Area on Channel 9 still features specific Windows 7 videos and screencasts. Over the past few weeks, we created new videos that I am sure you will find exciting and helpful, including a new Mark Russinovich video. As a friendly reminder, the &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Mark-Russinovich-Inside-Windows-7/"&gt;last video&lt;/a&gt; Mark did, “&lt;a href="http://channel9.msdn.com/shows/Going+Deep/Mark-Russinovich-Inside-Windows-7/"&gt;Mark Russinovich: Inside Windows 7&lt;/a&gt;, was a Channel 9 blockbuster. If you haven't already viewed it, I highly recommend it, and make sure you see Mark’s new video &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Mark-Russinovich-Inside-Windows-7-Redux/"&gt;Mark Russinovich: Inside Windows 7 Redux&lt;/a&gt;. Don’t forget to stay up-to-date with other topics: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/windows/using/"&gt;Using Windows 7&lt;/a&gt; – Contains consumer- and user-related videos such as how to install Windows 7 and how to set up a home group network &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/windows/programming/"&gt;Programming Windows 7&lt;/a&gt; – I don’t really need to explain what goes here, right? &lt;/li&gt;    &lt;li&gt;Last but not least, “&lt;a href="http://channel9.msdn.com/windows/under-the-hood/"&gt;Under the Hood&lt;/a&gt;” –Covers deep architectural Windows concepts&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;MSDN Developer Center&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/windows/default.aspx"&gt;MSDN Developer Center&lt;/a&gt; also received a “Windows 7 GA refresh” and now sports a new look and much improved functionality. The MSDN Developer Center includes a lot of &lt;a href="http://msdn.microsoft.com/en-us/windows/aa904962.aspx"&gt;Windows 7 material&lt;/a&gt; that extends the training content on available on Channel 9. You can think of the MSDN Developer Center as a hub for the Windows 7 content that will give you a great head start as you develop applications that will shine on Windows 7. You can find information about specific topics, review different programming models, learn about the developer tools that you can use, watch videos, and read blogs.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/aa904962.aspx" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_5AB24EC3.png" width="561" height="433" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;A New Book for Windows 7 Developers&lt;/b&gt;&lt;/p&gt;    &lt;table border="0" cellspacing="0" cellpadding="20" width="557"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="290"&gt;Among the other things that you will find on the MSDN Developer Center, is a list of &lt;a href="http://msdn.microsoft.com/en-us/windows/dd722803.aspx"&gt;recommended Windows 7 &lt;/a&gt;books for developers. It turns out that over the past few months, I’ve been busy writing a Windows 7 book with three amazing co-authors: Laurence Moroney, Sasha Goldshtein, and Alon Fliess. Together, we wrote &lt;i&gt;&lt;a href="http://www.amazon.com/gp/product/0735626820?ie=UTF8&amp;amp;tag=msdn-winc-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0735626820"&gt;Introducing Windows 7 for Developers&lt;/a&gt;&lt;/i&gt;. It covers most of the exciting Windows 7 features like the Taskbar, Libraries, Sensor and Location, Multitouch (including new WPF 4 support with VS2010), and even Silverlight out of &lt;/td&gt;        &lt;td valign="top" width="265"&gt;&lt;a href="http://www.amazon.com/gp/product/0735626820?ie=UTF8&amp;amp;tag=msdn-winc-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0735626820" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_67AC2ED4.png" width="237" height="285" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;browser (including touch :). As far as I know, this is the first Windows 7 developer book, and I hope you will find it useful. Mark Russinovich found this book helpful while integrating Windows 7 features with the Sysinternals tools and he wrote the foreword for this book.&lt;/p&gt;  &lt;p&gt;I hope this list will help get you on your way to writing amazing Windows 7 applications.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=527063" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows/default.aspx">Windows</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Libraries/default.aspx">Libraries</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Channel+9/default.aspx">Channel 9</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Labs/default.aspx">Labs</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category></item><item><title>Windows 7 Labs @ PDC</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/16/windows-7-labs-pdc.aspx</link><pubDate>Fri, 16 Oct 2009 16:46:14 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:526600</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=526600</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/16/windows-7-labs-pdc.aspx#comments</comments><description>&lt;p&gt;PDC 2009 takes place at the LA Convention Center on November 17&lt;sup&gt;th&lt;/sup&gt;, 18&lt;sup&gt;th&lt;/sup&gt;, and 19&lt;sup&gt;th&lt;/sup&gt;. As I wrote &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/08/windows-7-at-pdc09.aspx"&gt;before&lt;/a&gt;, The Professional Developers Conference is the one event each developer has to attend. Windows 7 will become generally available (GA) to the public on October 22nd. With the pre-release veil of secrecy lifted, during this year's PDC we can dive deep (very deep) into Windows 7 to extend our understanding of how Windows 7 works and, even more importantly, how developers can take advantage of all the great new improvements and features Windows 7 has to offer.&lt;/p&gt;  &lt;p&gt;Just in case you missed my previous announcement, there is a &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/07/free-windows-7-seminar-with-mark-russinovich-and-friends.aspx"&gt;FREE Windows 7 (seminar) Boot Camp&lt;/a&gt; led by top Microsoft Windows experts like &lt;a href="http://www.microsoft.com/presspass/exec/techfellow/Russinovich/default.mspx"&gt;Mark Russinovich&lt;/a&gt;, &lt;a href="http://www.microsoft.com/presspass/exec/de/Wang/default.mspx"&gt;Landy Wang&lt;/a&gt;, and Arun Kishan. Then, during the PDC proper, we’ll have &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/08/windows-7-at-pdc09.aspx"&gt;several deep-dive Windows 7 sessions&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;During this year's PDC, we’ll host the &lt;strong&gt;Windows 7 Developer Center&lt;/strong&gt;. The Windows 7 Developer Center gives you the opportunity to test your application on Windows 7, identify and solve problems with a group of consultants, and eventually get your application Logo-certified. Applications can be loaded onto a secure Windows 7 test platform in a private developer lab environment for Logo testing and submission. Our Windows Applications Developer Consultants can also help with Windows Compatibility questions or offer specific guidance for how you can make your application shine on Windows 7. You can pre-book a time slot right away, book a time when you get to the PDC, or just stop by Room 504/505. And guess what? It is all free; all you need to do is register. &lt;i&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Registration&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You can pre-register for a 1-hour timeslot in the lab as outlined below. You can also register upon arrival at PDC09 by signing up at the reception station located in &lt;b&gt;Room 504/505&lt;/b&gt;, or just stop by to talk about developing applications for Windows 7.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top"&gt;         &lt;p&gt;&lt;b&gt;Monday 11/16&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;10:00 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;11:00 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;1:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;2:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;3:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;4:00 pm&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;         &lt;p&gt;&lt;b&gt;Tuesday 11/17&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;11:00 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;1:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;2:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;3:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;4:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;5:00 pm&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;         &lt;p&gt;&lt;b&gt;Wednesday 11/18&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;11:00 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;1:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;2:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;3:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;4:00 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;5:00 pm&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;         &lt;p&gt;&lt;b&gt;Thursday 11/19&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;8:30 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;9:30 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;10:30 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;11:30 am&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;1:30 pm&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;2:30 pm&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Logo Test&lt;/b&gt; - To help maximize your time in the lab at PDC, we are asking that you run the Logo test and submit the .xml result report to our team for review prior to the event. Our consultants will analyze your results and prepare a report to review with you on-site at PDC.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;VeriSign &amp;amp; WinQual IDs&lt;/b&gt; – In order to submit your product for Windows 7 Logo, you will need to obtain both of these credentials. Once obtained, you will be able to work directly with a Microsoft consultant through the submission process while on-site at PDC. (More info here - &lt;a href="https://winqual.microsoft.com/"&gt;https://winqual.microsoft.com/&lt;/a&gt;.)&lt;/p&gt;  &lt;p&gt;Follow these simple steps to register and prepare for PDC 2009:&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;1. Email &lt;a href="mailto:srglabs@microsoft.com"&gt;srglabs@microsoft.com&lt;/a&gt; with &lt;strong&gt;3&lt;/strong&gt; timeslots in order of preference from those listed above.&lt;/p&gt;  &lt;p&gt;2. Download the Logo toolkit from &lt;a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=831"&gt;MS Connect&lt;/a&gt; and follow the instructions for testing.&lt;/p&gt;  &lt;p&gt;3. Send the .xml result report generated by the Logo toolkit to &lt;a href="mailto:srglabs@microsoft.com"&gt;srglabs@microsoft.com&lt;/a&gt; for analysis.&lt;/p&gt;  &lt;p&gt;4. Sign up for VeriSign &amp;amp; WinQual IDs that will be required for Logo submission by visiting &lt;a href="https://winqual.microsoft.com/"&gt;https://winqual.microsoft.com/&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Additional Resources&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;• For general questions contact &lt;a href="mailto:srglabs@microsoft.com"&gt;srglabs@microsoft.com&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;• For questions and more details about the Windows 7 Logo Program visit &lt;a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=831"&gt;MS Connect&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This is a great opportunity to prepare your applications for Windows 7, but there is limited availability so be sure to register early to get your preferred time slot.&lt;/p&gt;  &lt;p&gt;You can learn about Windows 7 using the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=1C333F06-FADB-4D93-9C80-402621C600E7&amp;amp;displaylang=en"&gt;Windows 7 Training Kit for Developers&lt;/a&gt; or by viewing Windows 7 videos on &lt;a href="http://channel9.msdn.com/windows"&gt;Channel 9&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=526600" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows/default.aspx">Windows</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Channel+9/default.aspx">Channel 9</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Labs/default.aspx">Labs</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/PDC/default.aspx">PDC</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Professional+Developers+Conference/default.aspx">Professional Developers Conference</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/PDC2009/default.aspx">PDC2009</category></item><item><title>Windows 7 At PDC09</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/08/windows-7-at-pdc09.aspx</link><pubDate>Thu, 08 Oct 2009 17:08:26 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:526314</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>18</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=526314</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/08/windows-7-at-pdc09.aspx#comments</comments><description>&lt;p&gt;The Professional Developers Conference (PDC) is the one event that all developers who use any Microsoft technologies must attend at least once in their professional careers. It’s the flagship event for developers, offering the most comprehensive, future-looking, technically deep, densely-packed set of sessions from Microsoft speakers you can find anywhere. This &lt;a href="http://microsoftpdc.com/"&gt;year’s PDC&lt;/a&gt; is no exception and you can expect it to be a very exciting event.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="20" width="556"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="419"&gt;         &lt;p&gt;My first PDC was PDC08, held last November at the LA Convention Center. As one of the people at Microsoft who work on Windows 7, I was fortunate enough to be in the loop regarding Windows 7 @ PDC08, and was able to contribute (even if only in a small way) to one of the keynote. During the Day 2 keynote, &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="135"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_0410E73D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_554B2E9A.png" width="140" height="87" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Steven Sinofsky presented Windows 7 to the world and for the first time people outside of Microsoft saw the new Taskbar, the Windows Ribbon, and witnessed a live multitouch demo. Attendees received a 160G hard drive (makes you wonder what they'll get this year…) with Windows 7 build 6800 (does anyone remember this build number?). The Windows team presented a lot of its technologies in a series of impressive sessions. And since then, through the different versions of Windows--Beta, RC, and RTM--we continued to push new content to help developers ramp up and get ready for Windows 7.&lt;/p&gt;  &lt;p&gt;Windows 7 will become “Generally Available” (GA) to the public on October 22&lt;sup&gt;nd&lt;/sup&gt;, exactly two weeks from today, and this year’s PDC takes place right after Windows 7 GA. With the pre-release veil of secrecy lifted, during this year's PDC we can dive deep (very deep) into Windows 7 to extend our understanding of how Windows 7 works and, even more importantly, how developers can take advantage of all the great new improvements and features Windows 7 has to offer. &lt;/p&gt;  &lt;p&gt;To start with, on the day before PDC09 starts, there is a &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/10/07/free-windows-7-seminar-with-mark-russinovich-and-friends.aspx"&gt;FREE Windows 7 (seminar) Boot Camp&lt;/a&gt; led by top Microsoft Windows experts like Mark Russinovich, Landy Wang, and Arun Kishan. Then, during the PDC proper, we’ll have several deep-dive Windows 7 sessions.&lt;/p&gt;  &lt;p&gt;So here is the first set of Windows 7 sessions that we are announcing:&lt;/p&gt;  &lt;p&gt;This first one is probably my favorite topic (I am a geek, what can I say). What could be more important than performance, especially as it relates to Windows 7 and applications running on Windows 7? This has to be a MUST Attend session for any developer who writes any software (native or .NET) for &lt;b&gt;Windows&lt;/b&gt; (and not just Windows 7) – this is truly a unique opportunity.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Optimizing for Performance with the Windows Performance Toolkit&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The Windows team uses the Windows Performance Toolkit (WPT) to optimize the Windows OS. Come and see how the Windows Performance team used the WPT throughout the Windows 7 development cycle to optimize for customer scenarios and how you can leverage many of its features and capabilities to help you build faster applications on Windows. This session will present case studies that demonstrate how you can use the toolkit to pinpoint areas for improvement in your application and provide you with some best practices to follow in order to create applications with optimum performance.&lt;/p&gt;  &lt;p&gt;The next two sessions are also personal favorites (you can’t blame me for loving Windows 7), as I think these technologies represent new levels of user interaction and adaptive user interfaces:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Building Sensor- and Location-aware Applications with Windows 7 and .NET&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;How many times have you thought to yourself, “My application would be so much better if it knew where the user was?” With Windows 7 and.NET Framework 4.0, you now have the tools at your fingertips to location-enable your applications. Based on the new Location platform for Windows 7, the location API in .NET Framework 4.0 provides a single, consistent API to get you your latitude and longitude regardless of the underlying technology that acquired it—allowing you to focus on creating exciting, differentiated location-aware applications.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Windows Touch Deep Dive&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Windows provides applications with a default experience for gestures and touch interaction. This provides applications that you want to go beyond that basic experience with a powerful platform to build upon. This session is targeted at developers interested in building touch-optimized experiences. We’ll look closely at some of the more powerful portions of the Touch platform, like manipulation and inertia processors, as well as cover real-world problems that developers have encountered and overcome. Come help build the next generation of user experiences!&lt;/p&gt;  &lt;p&gt;Another highly recommended session is the Windows Ribbon session. Before you dismiss the Ribbon, I suggest you take a second look and read between the lines of the Windows Ribbon native API. There is a lot of very interesting software architecture in the current API that provides a glimpse into tomorrow’s “commanding framework.”&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Windows Ribbon Technical Deep Dive&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;This talk will cover some of the more subtle and complex aspects of ribbon implementation, like designing a great gallery (a critical task for any ribbon), adding an outspace MRU, etc. We will draw from specific experiences with Windows Live and other partners and spread the learning that those teams amassed as Windows Ribbon guinea pigs.&lt;/p&gt;  &lt;p&gt;A lot has been said about the update to the Windows 7 graphics stack. This stack plays a major role in the performance improvements Windows 7 offers. You, as a developer, can tap into that user experience and start enjoying a rich and modern graphic framework that pushes GPUs to their limits.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Modern 3D Graphics Using Windows 7 &amp;amp; Direct3D 11 Hardware&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Dig deep into the capabilities of Direct3D 11 and Windows 7to gain practical knowledge that will help you push graphics to the limit. Learn about the new tessellation stage in Direct3D 11, which enables an unprecedented level of rendering quality by dynamically generating geometry on the GPU. In addition, see how the multi-core improvements in the Direct3D 11 runtime can help you scale your application to take full advantage of all of the cores on a machine. Finally, take a peek at the power of DirectCompute (the hardware-accelerated general purpose computing technology) in a graphics application context.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Advanced Graphics Functionality Using DirectX&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The number of PC configurations is exploding. With both netbooks and high-end desktop systems using the latest in graphics hardware, creating an application that can target all of these systems is getting harder every year. Join us as we explore the many options available in Windows 7 to facilitate graphics development across all kinds of hardware configurations, from low-end integrated GPUs to top of the line discrete GPUs. Learn about Direct3D 10 Level 9, which enables Direct3D 10 applications to run on pretty much every computer in the market today. Check out WARP, our new software rasterizer that lets your application use high-quality graphics even when there’s no graphics card. Finally, learn about Direct2D, DirectWrite, WIC, and the interoperability of Windows 7 technologies for making slick, high-quality graphics for your applications of the future.&lt;/p&gt;  &lt;p&gt;The last session for today’s post, but most certainly not the least, is about the &lt;a href="http://code.msdn.microsoft.com/WindowsAPICodePack"&gt;Windows API Code Pack for the Microsoft .NET framework&lt;/a&gt;. This is a framework that I have a personal interest in and I often blog about. With Visual Studio 2010 and .NET 4, .NET developers have an easier life. Nonetheless, there are still a great number of valuable Windows APIs that are NOT in the framework. This Open Source library provides a good intermediate solution.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Developing with the Windows API Code Pack for .NET Framework&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The Windows API Code Pack for Microsoft .NET Framework provides a source code library that you can use to access some new Windows 7 features (and some existing features of older versions of the Windows operating system) from managed code. These Windows features are not available to developers today in the .NET Framework. This session will show you how to access features like taskbar integration, JumpLists, libraries, the sensor platform, Direct2D, and more.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=526314" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows/default.aspx">Windows</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Multi-Touch/default.aspx">Multi-Touch</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Taskbar/default.aspx">Taskbar</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sensor+and+Location/default.aspx">Sensor and Location</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Libraries/default.aspx">Libraries</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/PDC09/default.aspx">PDC09</category></item><item><title>Free Windows 7 Seminar with Mark Russinovich (and Friends)</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/07/free-windows-7-seminar-with-mark-russinovich-and-friends.aspx</link><pubDate>Wed, 07 Oct 2009 19:17:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:526269</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>27</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=526269</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/07/free-windows-7-seminar-with-mark-russinovich-and-friends.aspx#comments</comments><description>&lt;p&gt;Have you ever wondered how Windows 7 resumes from sleep in less than 2 seconds? Or how Windows 7 can scale up to 256 cores? Or maybe you just want to want to learn about any Kernel improvements that will make your application run faster with no extra effort from you? &lt;/p&gt;
&lt;p align="left"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/PDC_5F00_Win_5F00_bootcamp_5F00_5E9DE442.jpg"&gt;&lt;img height="240" width="191" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/PDC_5F00_Win_5F00_bootcamp_5F00_thumb_5F00_4BE8EA8B.jpg" alt="PDC_Win_bootcamp" border="0" title="PDC_Win_bootcamp" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="left"&gt;Well, guess what? On Monday, November 16&lt;sup&gt;th&lt;/sup&gt;, the day before &lt;a href="http://microsoftpdc.com/"&gt;PDC 2009&lt;/a&gt; starts, we are running a &lt;b&gt;FREE&lt;/b&gt; Windows 7 Workshop&lt;b&gt; &lt;/b&gt;&amp;ndash;&lt;b&gt; &lt;/b&gt;AKA &lt;a href="http://microsoftpdc.com/Sessions/WKSP08"&gt;&lt;b&gt;Windows 7 Developer Boot Camp&lt;/b&gt;&lt;/a&gt;. That is&amp;nbsp; right, it's &lt;b&gt;FREE&lt;/b&gt; for anyone who wants to attend. Windows 7 is one of the most exciting pivotal releases of the year. As part of the wave of activity surrounding the product launch, we're opening up this workshop to &lt;b&gt;anyone&lt;/b&gt; who wants to attend - even if &lt;b&gt;you're not&lt;/b&gt; able to join the rest of the conference. So, if you live LA, its surroundings, or even the Bay Area, you can attend this workshop for FREE!&lt;/p&gt;
&lt;p&gt;Wait a minute! By now, you must be thinking to yourself, &amp;ldquo;If it is free, it can&amp;rsquo;t be that good.&amp;rdquo; Well it turns out that this Windows 7 Developers Boot Camp will include top Microsoft Windows experts like &lt;a href="http://www.microsoft.com/presspass/exec/techfellow/Russinovich/default.mspx"&gt;Mark Russinovich&lt;/a&gt;, &lt;a href="http://www.microsoft.com/presspass/exec/de/Wang/default.mspx"&gt;Landy Wang&lt;/a&gt;, and Arun Kishan. These are the guys who are behind a large number of the amazing performance improvements in Windows 7, and this is your onetime chance to meet them in person for an intense, deep, and high-quality session. Mark, Landy, and Arun will start by talking about Kernel and architectural improvements, for example, the &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Arun-Kishan-Farewell-to-the-Windows-Kernel-Dispatcher-Lock/"&gt;Kernel Dispatcher Lock&lt;/a&gt;, new and even more efficient &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Landy-Wang-Windows-Memory-Manager/"&gt;Windows Memory Management&lt;/a&gt;, and &lt;a href="http://channel9.msdn.com/posts/philpenn/Trigger-Started-Services/"&gt;Trigger Start Services&lt;/a&gt;, among many other topics. &lt;/p&gt;
&lt;p&gt;Next, they&amp;rsquo;ll take a dive deep into the different APIs, paying special attention to the new shell integration points in Windows 7 such as the taskbar, libraries, and search. Right after that, they&amp;rsquo;ll give some tips for getting the most out of today&amp;rsquo;s hardware using the Sensor &amp;amp; Location platform, multitouch, and the new graphics libraries (Direct2D, DirectX 11) that take advantage of the GPU. &lt;/p&gt;
&lt;p&gt;Regardless of whether you&amp;rsquo;re a C++, C#, or Visual Basic developer, if you're building a Windows application and you want your application to have the best possible performance, experience, and look-and-feel while running on Windows 7, this event is for you! I know I will be there; what about you?&lt;/p&gt;
&lt;p&gt;&lt;a href="http://microsoftpdc.com/Workshops"&gt;Register for the PDC Workshop&lt;/a&gt; or read more info about the &lt;a href="http://microsoftpdc.com/Sessions/WKSP08"&gt;Windows 7 Boot Camp&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=526269" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Multi-Touch/default.aspx">Multi-Touch</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Taskbar/default.aspx">Taskbar</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sensor+and+Location/default.aspx">Sensor and Location</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Libraries/default.aspx">Libraries</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category></item><item><title>Session 0 Isolation</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/10/01/session-0-isolation.aspx</link><pubDate>Thu, 01 Oct 2009 17:19:41 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:525724</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=525724</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/10/01/session-0-isolation.aspx#comments</comments><description>&lt;p&gt;It has been a while since the last blog posting, &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/08/06/windows-7-rtm-go-get-it.aspx"&gt;Windows 7 RTM – Go Get It&lt;/a&gt;, and we have a lot of catching up to do. &lt;/p&gt;  &lt;p&gt;The Windows 7 GA data is still October 22&lt;sup&gt;nd&lt;/sup&gt;, less than a month away, which means your application should be almost &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/07/23/is-your-application-ready-for-windows-7-rtm.aspx"&gt;ready for Windows 7&lt;/a&gt;. As you prepare your applications for Window 7, be sure to verify that you don’t have any issues with &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/08/05/version-checking-just-don-t-do-it.aspx"&gt;version checking&lt;/a&gt; and &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/08/04/user-account-control-data-redirection.aspx"&gt;UAC Data Redirection&lt;/a&gt;. This post topic, Session 0 Isolation, is another application compatibility topic that requires our special attention, especially if your applications include services. If your services are working on Windows Vista, most likely they will continue to work on Windows 7 (still you need to test your application fully on Windows 7). However, if you didn’t run the proper compatibility testing on Windows Vista, you might want to take few moments to read this post.&lt;/p&gt;  &lt;p&gt;Let’s start with a better understanding of what services are.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;What are services?&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;A service is an integral mechanism built into Microsoft Windows operating systems. You can think of services as “special applications” that run with no regard to the current user context. Services are different from “regular” user applications because you can configure a service to run from the time a system starts up (boots) until it shuts down, without requiring an active user to be present – that is, services can run without having any users logged on.&lt;/p&gt;  &lt;p&gt;We like to think about services as running “tasks” for us in the background without interfering with user operations. Services on Windows are responsible for all kinds of background activity that do not involve the user, ranging from the Remote Procedure Call (RPC) service, through Printer Spoolers, to the Network Location Awareness service.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;What’s the problem?&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Some services may attempt to display user interface dialogs or communicate with user applications. Such functionality is “typical” of Windows XP services, mainly because it is easy to do so. If you happen to own a service that attempts to display some user interface objects, like a dialog box, or tries to communicate with applications you might run into trouble running on Windows 7. &lt;/p&gt;  &lt;p&gt;When running a service that is trying to display a dialog box on Windows 7, instead of the desired dialog box, you will see an annoying flashing icon on the taskbar. And, if you press on that flashing icon, you will see a dialog box. To be more specific, when running on Windows 7, your service may experiences one or more of the following symptoms. The service:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Is running, but cannot do what it is supposed to do, and just eats CPU cycles and memory &lt;/li&gt;    &lt;li&gt;Is running, but other processes can't communicate with it and it cannot communicate with the user, or other applications / services &lt;/li&gt;    &lt;li&gt;Is trying to communicate with user applications through window messages, but the window messages are not reaching their destination &lt;/li&gt;    &lt;li&gt;Displays a flashing icon on the taskbar indicating the service wants to interact with the desktop &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All the above symptoms point to the conclusion that your service is experiencing &lt;b&gt;&lt;i&gt;Session 0 Isolation of Windows 7 Services&lt;/i&gt;&lt;/b&gt;, that is, the “physical” separation between services and user applications, but more about that in just a bit. First, let’s define the two “buckets of issues” your services may experience when running on Windows 7:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;The service fails to display a UI or it displays a mitigation UI&lt;/b&gt; (or annoying flashing dialog box): When a service attempts to show any user interface element (even if it is allowed to interact with the desktop), a mitigation layer prompts the user with the &lt;b&gt;Interactive services dialog detection&lt;/b&gt; dialog box, as shown in the next image. This notification dialog appears on the user’s desktop.&amp;#160; If the user clicks to see “the message”, the display switches to a secure desktop. The user may opt in to see the service UI dialog, but the interruption in workflow makes this a serious application compatibility issue. Furthermore, some users may not react very well to a dialog that blocks your services / application from getting the user input and breaking the flow of the application. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_4AD5B03A.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_0E3DB19D.png" width="377" height="209" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Objects shared by services and applications become invisible or inaccessible: &lt;/b&gt;When an object created by a service is accessed by a standard application (running with standard user privileges), the object cannot be found in the global namespace (that is, it is private to session 0). This means that other applications will not be able to access the so-called “shared object” from the global namespace, and most certainly, not directly from session 0. Additionally, security changes might warrant a situation where even if the object is visible, it is not accessible. This may affect other processes (such as standard user applications) from interacting with your service, again breaking the application flow. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Clearly, Session 0 Isolation has the potential of being a serious compatibility pain. Well, this post should provide you with enough information to identify if your service is at “risk” -- and how to solve the problem. &lt;strong&gt;However&lt;/strong&gt;, I have to remind you that the main reason for isolating services from user application is making it &lt;u&gt;harder &lt;/u&gt;for &lt;u&gt;malicious &lt;/u&gt;software to run with elevated privileges, which enables them to do far more harm than running as standard user as explained in the following section, thus making Windows &lt;strong&gt;much more secure &lt;/strong&gt;operating system.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;The Reason: Session 0 Isolation of Windows 7 Services&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In Windows XP, Windows Server 2003, and earlier versions of the Windows operating system, services and applications run in the same session as the one started by the first user who logs onto the console. This session is called Session 0, and as shown in the following image, prior to Windows Vista, Session 0 included both services and standard user applications.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_6D4A3EF5.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_5A95453E.png" width="496" height="374" /&gt;&lt;/a&gt;&lt;font size="1"&gt;Image source: &lt;/font&gt;&lt;a href="http://www.microsoft.com/whdc/system/vista/services.mspx"&gt;&lt;font size="1"&gt;http://www.microsoft.com/whdc/system/vista/services.mspx&lt;/font&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Running services and user applications together in Session 0 poses a security risk because services run with elevated privileges, while user applications run with user privileges (most of which are not admin).This makes the services targets for malicious agents that are looking for mechanisms to elevate their own privilege levels by “hijacking” the services. &lt;/p&gt;  &lt;p&gt;Starting with Windows Vista, only services are hosted in Session 0. User applications are isolated from services, and run in subsequent sessions created when users log onto the system: Session 1 for the first logged on user, Session 2 for the second, and so on, as shown in the following image.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_60DC1BCC.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_52316FE7.png" width="508" height="380" /&gt;&lt;/a&gt;&lt;font size="1"&gt;Image source: &lt;/font&gt;&lt;a href="http://www.microsoft.com/whdc/system/vista/services.mspx"&gt;&lt;font size="1"&gt;http://www.microsoft.com/whdc/system/vista/services.mspx&lt;/font&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Entities (applications or services) running in different sessions &lt;b&gt;cannot&lt;/b&gt; send each other messages, share UI elements, or share kernel objects without explicitly qualifying them to the global namespace and providing the appropriate access control settings. The following image illustrates this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_3F7C7630.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_058D3344.png" width="476" height="193" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;You can find additional valuable information about this in &lt;i&gt;Impact of Session 0 Isolation on Services and Drivers in Windows Vista &lt;/i&gt;(&lt;a href="http://www.microsoft.com/whdc/system/vista/services.mspx"&gt;http://www.microsoft.com/whdc/system/vista/services.mspx&lt;/a&gt;), an article that is equally applicable to Windows 7.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;How can you detect whether your service might experience some of the above-mentioned problems?&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;So far, we have presented the symptoms associated with Session 0 isolation of Windows services, explained what service isolation is, and how it may affect your services and applications. Below are tests and other actions you can take in order to pinpoint your real problem and start resolving it.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Test #1 – Verifying service (or any other process) session assignment&lt;/b&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Launch Process Explorer.      &lt;ol&gt;       &lt;li&gt;To download or learn more about Process Explorer, see the &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx"&gt;Process Explorer Web site&lt;/a&gt; on Microsoft TechNet. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Ensure that Process Explorer displays all processes:      &lt;ol&gt;       &lt;li&gt;Click &lt;b&gt;File.&lt;/b&gt; &lt;/li&gt;        &lt;li&gt;Choose &lt;strong&gt;Show Details from All Processes&lt;/strong&gt;. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Locate the &lt;strong&gt;first&lt;/strong&gt; csrss.exe process, which is a service found under the System Idle Process (see next image), and inspect its properties:       &lt;ol&gt;       &lt;li&gt;Right-click the process. &lt;/li&gt;        &lt;li&gt;Select &lt;b&gt;Properties.&lt;/b&gt; &lt;/li&gt;        &lt;li&gt;Navigate to the &lt;b&gt;Security&lt;/b&gt; tab. &lt;/li&gt;        &lt;li&gt;Note the session in which the service runs (typically Session 0) and its integrity level. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Locate the &lt;strong&gt;second &lt;/strong&gt;csrss.exe process, found under the Wininit.exe (see next image), and inspect its properties as you did in step #3: &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_76E2875E.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_481CCEBC.png" width="295" height="343" /&gt;&lt;/a&gt;The left image shows the process properties for the csrss.exe instance that runs at the system integrity level - session 0, while the image on the right shows the process properties for the csrss.exe instance that runs also with System integrity level but in a different session - session 1: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_5C35EB45.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_62108EDE.png" width="563" height="325" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If your service is running under Session 0 and under a System integrity level, it will be unable to display UI directly. It is also likely that you will experience problems when sharing kernel objects or files with the service.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Test #2 – Ensuring object accessibility&lt;/b&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Launch Process Explorer. &lt;/li&gt;    &lt;li&gt;Ensure that Process Explorer displays all processes:      &lt;ol&gt;       &lt;li&gt;Click &lt;b&gt;File.&lt;/b&gt; &lt;/li&gt;        &lt;li&gt;Choose &lt;strong&gt;Show Details from All Processes&lt;/strong&gt;. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Locate the suspected service. &lt;/li&gt;    &lt;li&gt;If the service contains objects that you know are shared with user applications, inspect their handles in the Handles lower pane (press CTRL+H to see it, or access it from the &lt;b&gt;View&lt;/b&gt; menu).       &lt;ol&gt;       &lt;li&gt;Right-click each suspected handle and select &lt;b&gt;Properties&lt;/b&gt;. &lt;/li&gt;        &lt;li&gt;Switch to the &lt;b&gt;Security&lt;/b&gt; tab to see the users and groups that are allowed to access the object referenced by this handle. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The following image shows an example of a shared object that everyone can access (for the “Synchronize” right) even though it is opened in a system service that runs in session 0&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_32DEA347.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_723C56D7.png" width="290" height="301" /&gt;&lt;/a&gt;The following image displays an example of a shared object that only administrators and the SYSTEM group can access:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_117EFDAB.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_30C1A47E.png" width="292" height="304" /&gt;&lt;/a&gt;&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Now that you know what the problems could be, what about fixing them? &lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You've already done the hard part, knowing and understanding that you have a session 0 issue; solving these problems is easy.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Here are some ideas on how to solve the above mentioned problems: &lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If a service needs to interact with the user by sending a message, use the &lt;b&gt;WTSSendMessage&lt;/b&gt; function. It is almost identical in functionality to a &lt;b&gt;MessageBox&lt;/b&gt;. This will provide an adequate and simple solution to services that do not require an elaborate UI, and is secure because the displayed message box cannot be used to take control of the underlying service. &lt;/li&gt;    &lt;li&gt;If your service requires a more elaborate UI, use the &lt;b&gt;CreateProcessAsUser&lt;/b&gt; function to create a process in the requesting user’s desktop Note that you will still need to communicate between the newly created process and the original services, which is where the next bullet point kicks in. &lt;/li&gt;    &lt;li&gt;If two-way interaction is required, use Windows Communication Foundation (WCF), .NET remoting, named pipes, or any other interprocess communication (IPC) mechanism (&lt;b&gt;excluding window messages&lt;/b&gt;) to communicate across sessions. WCF and Remoting have a better security enforcement that will prompt the user (assuming UAC not shut-off) to elevate if needed. &lt;/li&gt;    &lt;li&gt;Ensure that kernel objects meant to be shared across sessions have names prefixed with the Global\ string, indicating that they belong in a session-global namespace. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Additional Resources&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You can find more-detailed information about this topic in the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=1C333F06-FADB-4D93-9C80-402621C600E7&amp;amp;displaylang=en"&gt;Windows 7 Training Kit for Developers&lt;/a&gt;, including a detailed whitepaper and hands-on-lab. If you want, you can download just the &lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples.AppCompat/Session-0-Isolation.zip"&gt;Session 0 Isolation hands-on-lab directly&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Here is some basic information about the tools used in this post:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Process Explorer&lt;/b&gt; – a monitoring tool for Windows processes that is able to display process integrity levels and object security information.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;More information: &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Download: &lt;a href="http://download.sysinternals.com/Files/ProcessExplorer.zip"&gt;http://download.sysinternals.com/Files/ProcessExplorer.zip&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p align="center"&gt;You can get much more information about this topic and others in &lt;a href="http://channel9.msdn.com/windows"&gt;Windows 7 topic page on channel 9&lt;/a&gt;.&lt;/p&gt;  &lt;p align="center"&gt;For more Windows 7 Technical content and hands-on experience download the - &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=1C333F06-FADB-4D93-9C80-402621C600E7&amp;amp;displaylang=en"&gt;Windows 7 Training Kit for Developers&lt;/a&gt; is also a great place to learn more about this topic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=525724" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Labs/default.aspx">Labs</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category></item><item><title>Windows 7 RTM – Go Get It</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/08/06/windows-7-rtm-go-get-it.aspx</link><pubDate>Thu, 06 Aug 2009 22:36:48 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:522353</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>42</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=522353</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/08/06/windows-7-rtm-go-get-it.aspx#comments</comments><description>&lt;p&gt;This is it people. Windows 7 RTM is available for download from &lt;a href="http://msdn.microsoft.com"&gt;MSDN&lt;/a&gt; &amp;amp; &lt;a href="http://technet.microsoft.com"&gt;TechNet&lt;/a&gt; sites! If you have a MSDN subscription you can get Windows 7 RTM in English. On October 1st, the remaining languages will be released, for more information read - &lt;a href="http://windowsteamblog.com/blogs/windows7/archive/2009/08/06/windows-7-rtm-available-today-for-msdn-amp-technet-subscribers.aspx"&gt;Windows 7 RTM Available Today for MSDN &amp;amp; TechNet Subscribers&lt;/a&gt;. You can also get the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=71deb800-c591-4f97-a900-bea146e4fae1&amp;amp;displaylang=en" target="_blank"&gt;Windows 7 SDK&lt;/a&gt;&amp;#160; and the RTM version of the &lt;a href="http://code.msdn.microsoft.com/WindowsAPICodePack"&gt;Windows API Code Pack for .NET Framework&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Make sure you get them all today to start testing your applications, and to make sure &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/07/23/is-your-application-ready-for-windows-7-rtm.aspx"&gt;your applications are ready for Windows 7 RTM&lt;/a&gt;! Now is the time to work on your applications to make sure they are Windows 7 compatible. On top of that, you can use new Windows 7 features such as the Sensor and Location Platform, Taskbar, Libraries, Multi-Touch, the new Graphics APIs, the Windows Ribbon, and many other important and exciting Windows 7 technologies to make your application shine on Windows 7.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;New Windows 7 Training Kit for Developers - Get it NOW!&lt;/strong&gt;&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="20" width="580"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="206"&gt;To help you get your application on Windows 7 as soon as possible, we updated the &lt;strong&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1c333f06-fadb-4d93-9c80-402621c600e7&amp;amp;displaylang=en" target="_blank"&gt;Windows 7 Training Kit for Developers&lt;/a&gt;&lt;/strong&gt; for the RTM version and gave it a new look and better functionality. You can still find all existing topics such as: Taskbar, Sensor and Location, Libraries and Shell, DirectX, Multi-touch, Ribbon, etc. No dev was left behind! The kit is built for both native Win32 &lt;/td&gt;        &lt;td valign="top" width="374"&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1c333f06-fadb-4d93-9c80-402621c600e7&amp;amp;displaylang=en"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Windows7TrainingKit" border="0" alt="Windows7TrainingKit" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/Windows7TrainingKit_5F00_18500CB9.png" width="389" height="314" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;C++ developers and .NET developers, so now most topics have multiple labs.We also added 6 new Application Compatibility labs: Version Checking, Data Redirection, UIPI, Installer Detection, Session 0 Isolation, and High DPI, to help you get over the most common application compatibility issues. All the topics in the training kit include additional information like whitepapers, links to MSDN, and links to &lt;strong&gt;videos from Channel 9&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;strong&gt;Updated Windows Topic Area on Channel 9&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;We also gave the &lt;a href="http://channel9.msdn.com/windows/"&gt;Windows topic area on Channel 9&lt;/a&gt; a brand new look and functionality to help you to better choose the right Windows 7 content you need. In the new Windows topic area for Channel 9, you can choose from three main topic areas:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/windows/using/"&gt;Using Windows 7&lt;/a&gt; – Contains consumer- and user-related videos such as how to install Windows 7 and how to set up a home group network &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/windows/programming/"&gt;Programming Windows 7&lt;/a&gt; – I don’t really need to explain what goes here, right? &lt;/li&gt;    &lt;li&gt;Last but not least, “&lt;a href="http://channel9.msdn.com/windows/under-the-hood/"&gt;Under the Hood&lt;/a&gt;” – Contains classics like the &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Mark-Russinovich-Inside-Windows-7/"&gt;interview with Mark Russinovich&lt;/a&gt; on Windows 7 Internals. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/windows/"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="NewC9" border="0" alt="NewC9" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/NewC9_5F00_3189E47C.png" width="549" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;While we hope you find all this helpful, this is only the start! We are working on more new and exciting content that will be shipped in the following weeks, so stay tuned.&lt;/p&gt;  &lt;p&gt;In the meantime, here is some additional useful information:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The &lt;a href="http://msdn.microsoft.com/en-us/windows/default.aspx"&gt;Windows page&lt;/a&gt; on MSDN is the one-stop shop for Windows client developers &lt;/li&gt;    &lt;li&gt;At &lt;a href="http://msdn.microsoft.com/en-us/windows/dd433113.aspx"&gt;Develop for Windows 7&lt;/a&gt;, you can find all the information you need about specific technologies like Direct2D, Taskbar, Sensor and Location, Power Shell 2, Windows Ribbon, and many more &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/dd433113.aspx"&gt;Windows Application Compatibility&lt;/a&gt; is the one page you want to visit to make sure your application runs properly on Windows 7; it includes content and tools to test and fix many application compatibility issues. Directly accessible from that page, is the &lt;a href="http://msdn.microsoft.com/library/dd371778(VS.85).aspx"&gt;Windows 7 Application Quality Cookbook&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Also still very relevant, is the &lt;a href="http://msdn.microsoft.com/en-us/library/bb757005.aspx"&gt;Windows Vista Application Compatibility Cookbook&lt;/a&gt;--most Windows 7 compatibility issues are the direct result of the changes introduced in the Windows Vista timeframe, and are included as topics in this Cookbook (UAC, Session 0 Service Isolation, IE Protected Mode, etc.), which is a great starting point for addressing these issues &lt;/li&gt;    &lt;li&gt;New Windows 7 videos on the &lt;a href="http://channel9.msdn.com/windows"&gt;Channel 9 Windows &lt;/a&gt;page explore specific features and technologies, and are great “windows” to the Windows engineering team &lt;/li&gt;    &lt;li&gt;As always, the &lt;a href="http://blogs.msdn.com/e7"&gt;E7 blog&lt;/a&gt; is an amazing source of the engineering back story behind Windows 7 &lt;/li&gt;    &lt;li&gt;Last, but not least, for IT-Pro, we have our &lt;a href="http://technet.microsoft.com/en-us/windows/dd361745.aspx"&gt;SPRINGBOARD SERIES&lt;/a&gt;, and &lt;a href="http://edge.technet.com/windows/" target="_blank"&gt;edge on TechNet&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And, of course, continue to watch for new posts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=522353" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Channel+9/default.aspx">Channel 9</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Labs/default.aspx">Labs</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Training+Kit/default.aspx">Windows 7 Training Kit</category></item><item><title>Version Checking (Just Don’t Do It)</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/08/05/version-checking-just-don-t-do-it.aspx</link><pubDate>Wed, 05 Aug 2009 22:55:33 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:522166</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=522166</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/08/05/version-checking-just-don-t-do-it.aspx#comments</comments><description>&lt;p&gt;Version checking is probably one of the most common Application Compatibility issues that both developers and users are facing. This is another post in a series of posts about &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/07/23/is-your-application-ready-for-windows-7-rtm.aspx" target="_blank"&gt;Getting Ready for Windows 7&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;As said, this is probably the most common application compatibility issue that users as well as developers face is when an application fails upon checking the operating system version. A lot can go wrong when version checking is misused. A user might experience a “silent fail” where the application simply fails to load and nothing happens. Or, a user might see a dialog box indicating something to the effect of “you must be running Microsoft Windows XP or later” when in fact, the computer is running Windows 7. Many other consequences to poor version checking can inconvenience users as well. &lt;/p&gt;  &lt;p&gt;Applications fail due to version checking for two main reasons:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A flaw (bug) in the version checking code, which fails if the minor version is decreased, even if the major version is increased, for example, changing versions from 5.1(Windows XP) to 6.0 (Windows Vista), or if the expected service pack (SP) is not installed, even if you're running a newer operating system (for example, changing versions from Windows XP SP 2 to Windows Vista SP 1). We recommend that you check functionality rather then checking version, as you can read in this post. &lt;/li&gt;    &lt;li&gt;An intentional blocking that prevents the application from running on operating system versions not tested by its developers. We recommend that you &lt;strong&gt;do not &lt;/strong&gt;block applications from running on future operating systems. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When an application runs on an &amp;quot;incompatible&amp;quot; (due to poor version checking) version of Windows, it will generally display an error message, but it may also exit silently or behave erratically. Often, if we work around the version checking, the application will run well. End-users and IT professionals may apply a fix to let the application think it is running on an older version of Windows.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Working Around The Problem (not really solving the bug)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Compatibility mode:&lt;/b&gt; Designed for &lt;strong&gt;end users&lt;/strong&gt; (not for developers to not fix their bugs), compatibility mode is an easy way to work around compatibility issues. When enabled, it applies a set of compatibility fixes that provide a runtime environment more compatible with applications written for older versions of Windows. One of those fixes is the &amp;quot;version lie,&amp;quot; which makes the version query functions return the operating system version the user chose in the &lt;b&gt;Compatibility&lt;/b&gt; tab of the &lt;b&gt;Properties&lt;/b&gt; dialog box instead of the actual Windows version.&lt;/p&gt;  &lt;p&gt;To enable compatibility mode:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Right-click the executable or shortcut to the executable. &lt;/li&gt;    &lt;li&gt;Click &lt;b&gt;Properties&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Click the &lt;b&gt;Compatibility&lt;/b&gt; tab. &lt;/li&gt;    &lt;li&gt;Enable &lt;b&gt;Run this program in compatibility mode for:&lt;/b&gt; and select the operating system version you think the application should be able to run on.       &lt;br /&gt;Some applications consist of several executables. You may need to apply this fix to each one. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_14A7A765.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_53992800.png" width="251" height="341" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Click OK to close the dialog box. &lt;/li&gt;    &lt;li&gt;Run the application. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Checking for Features Rather Than Version&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As mentioned previously, checking the operating system version is not the best way to confirm that a specific operating system feature is available. This is because the operating system may have had new features added in a redistributable DLL. Rather than using GetVersionEx to determine the operating system platform or version number, it is more effective to test for the presence of the feature itself. For example, we plan to make the Direct2D and DirectWrite APIs and the Ribbon API available in Windows Vista, so there is no need to block your application from using these APIs when running on Windows Vista. You just need to check if these features are available on the Operation System that you are running. If possible, your application should still run if the feature is unavailable, though with reduced functionality or performance.&lt;/p&gt;  &lt;p&gt;You can use one of the following techniques to find out if a specific features is available on the given OS.&lt;/p&gt;  &lt;p&gt;For Win32 developers:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Use &lt;b&gt;LoadLibrary&lt;/b&gt;() to load a library which is not yet loaded into your application. If you are interested in a new function of a DLL which is already loaded (for example, kernel32.dll), then call &lt;b&gt;GetModuleHandle&lt;/b&gt;() to obtain the module handle. If either of these functions return NULL, then this indicates an error. &lt;/li&gt;    &lt;li&gt;Use &lt;b&gt;GetProcAddress&lt;/b&gt;() to obtain a function pointer. If &lt;b&gt;GetProcAddress()&lt;/b&gt; returns NULL, then the function may not exist. Cast the pointer to a function pointer of an appropriate prototype. Some functions, although they exist may actually be stubs that return a &amp;quot;not implemented&amp;quot; error. Be such to check for such errors. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Windows 7 introduces a new timer API - SetWaitableTimerEXProc, which adds one more input variable to the regular SetWaitableTimerProc. The TolerableDelay lets you specific a time tolerance window in which the timer can expire. This is a new in Windows 7, that we will use to demonstrate how to check for feature.&lt;/p&gt;  &lt;pre class="code"&gt;      &lt;span style="color: green"&gt;// define function pointer type
    &lt;/span&gt;&lt;span style="color: blue"&gt;typedef &lt;/span&gt;BOOL (WINAPI *SetWaitableTimerExProc)(
      __in  HANDLE hTimer,
      __in  &lt;span style="color: blue"&gt;const &lt;/span&gt;LARGE_INTEGER *lpDueTime,
      __in  LONG lPeriod,
      __in  PTIMERAPCROUTINE pfnCompletionRoutine,
      __in  LPVOID lpArgToCompletionRoutine,
      __in  PREASON_CONTEXT WakeContext,
      __in  ULONG TolerableDelay
    );

    LARGE_INTEGER liDueTime;
    liDueTime.QuadPart = 0;
    nt period = 1000;
    &lt;span style="color: blue"&gt;unsigned int &lt;/span&gt;tolerance = 1000;
    HANDLE hTimer = &lt;span style="color: green"&gt;// Get timer handle

    &lt;/span&gt;REASON_CONTEXT reasonContext = {0};
    reasonContext.Version = 0;
    reasonContext.Flags = POWER_REQUEST_CONTEXT_SIMPLE_STRING;
    reasonContext.Reason.SimpleReasonString = L&lt;span style="color: #a31515"&gt;&amp;quot;MyTimer&amp;quot;&lt;/span&gt;;

    &lt;span style="color: green"&gt;// Get module handle to a module which is already loaded
    &lt;/span&gt;HMODULE hKernel32Module = GetModuleHandle(_T(&lt;span style="color: #a31515"&gt;&amp;quot;kernel32.dll&amp;quot;&lt;/span&gt;));
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(hKernel32Module == NULL)
        &lt;span style="color: blue"&gt;return &lt;/span&gt;FALSE;

    &lt;span style="color: green"&gt;// Get Address of function
    &lt;/span&gt;SetWaitableTimerExProc pFnSetWaitableTimerEx =
    (SetWaitableTimerExProc) ::GetProcAddress(hKernel32Module,     
        &lt;span style="color: #a31515"&gt;&amp;quot;SetWaitableTimerEx&amp;quot;&lt;/span&gt;);

    &lt;span style="color: green"&gt;// Check if the function exists    
    &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(pFnSetWaitableTimerEx == NULL)
        &lt;span style="color: blue"&gt;return &lt;/span&gt;FALSE;

    &lt;span style="color: green"&gt;// Call function
    &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(!pFnSetWaitableTimerEx(hTimer, &amp;amp;liDueTime, period, NULL, NULL,
            &amp;amp;reasonContext, tolerance)
    { &lt;span style="color: green"&gt;// handle error }

&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, you may use DLL delayed loading and call functions in a __try...__except block. (For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/151kt790.aspx"&gt;Linker Support for Delay-Loaded DLLs&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;For COM APIs, handle errors returned by &lt;b&gt;CoCreateInstance&lt;/b&gt; and &lt;b&gt;QueryInterface&lt;/b&gt;.NET framework applications that call Win32 APIs via &lt;b&gt;P/Invoke&lt;/b&gt; should handle &lt;b&gt;EntryPointNotFoundException&lt;/b&gt; and &lt;b&gt;DllNotFoundException&lt;/b&gt; exceptions.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If You Must Check OS Version Number&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Identifying the current operating system is not the best way to determine whether a particular operating system feature is present. However, if you can’t design your application to check for specific feature availability and the only way to ensure compatibility is through version checking, &lt;i&gt;then please consider the following&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;For native applications, you will need to ensure your application's logic will work with newer versions of Windows. Please &lt;strong&gt;DO NOT BLOCK &lt;/strong&gt;on version change! The following is a Win32 code example that uses &lt;b&gt;GetVersionEx&lt;/b&gt;. If the major version is greater than 5 (Windows Vista, Windows® Server 2008 R2 and Windows 7), the check passes. If it equals 5, then the minor version should be 1 or greater (Windows XP or Windows Server 2003).&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;#include &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;lt;windows.h&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;#include &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;lt;stdio.h&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;main()
{
    OSVERSIONINFO osvi;
    BOOL bIsWindowsXPorLater;

    ZeroMemory(&amp;amp;osvi, &lt;span style="color: blue"&gt;sizeof&lt;/span&gt;(OSVERSIONINFO));
    osvi.dwOSVersionInfoSize = &lt;span style="color: blue"&gt;sizeof&lt;/span&gt;(OSVERSIONINFO);

    GetVersionEx(&amp;amp;osvi);

    bIsWindowsXPorLater = 
 ( (osvi.dwMajorVersion &amp;gt; 5) ||
       ( (osvi.dwMajorVersion == 5) &amp;amp;&amp;amp; (osvi.dwMinorVersion &amp;gt;= 1) ));

    &lt;span style="color: blue"&gt;if&lt;/span&gt;(bIsWindowsXPorLater)
  printf(&lt;span style="color: #a31515"&gt;&amp;quot;The system meets the requirements.\n&amp;quot;&lt;/span&gt;);
    &lt;span style="color: blue"&gt;else &lt;/span&gt;printf(&lt;span style="color: #a31515"&gt;&amp;quot;The system does not meet the requirements.\n&amp;quot;&lt;/span&gt;);
}&lt;/pre&gt;

&lt;p&gt;However there is a better way to verify the minimum OS version required using &lt;a href="http://msdn.microsoft.com/en-us/library/ms725492(VS.85).aspx"&gt;VerifiyVersionInfo()&lt;/a&gt;. This function compares a set of operating system version requirements to the corresponding values for the currently running version of the system. The following code example uses &lt;b&gt;VerifyVersionInfo&lt;/b&gt; to check the operating system version against minimal requirements (Windows XP SP2):&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;#include &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;lt;windows.h&amp;gt;
&lt;/span&gt;BOOL Is_WinXP_SP2_or_Later () 
{
   OSVERSIONINFOEX osvi;
   DWORDLONG dwlConditionMask = 0;
   &lt;span style="color: blue"&gt;int &lt;/span&gt;op=VER_GREATER_EQUAL;

   &lt;span style="color: green"&gt;// Initialize the OSVERSIONINFOEX structure.

   &lt;/span&gt;ZeroMemory(&amp;amp;osvi, &lt;span style="color: blue"&gt;sizeof&lt;/span&gt;(OSVERSIONINFOEX));
   osvi.dwOSVersionInfoSize = &lt;span style="color: blue"&gt;sizeof&lt;/span&gt;(OSVERSIONINFOEX);
   osvi.dwMajorVersion = 5;
   osvi.dwMinorVersion = 1;
   osvi.wServicePackMajor = 2;
   osvi.wServicePackMinor = 0;

   &lt;span style="color: green"&gt;// Initialize the condition mask.

   &lt;/span&gt;VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, op );
   VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, op );
   VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMAJOR, op );
   VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMINOR, op );

   &lt;span style="color: green"&gt;// Perform the test.

   &lt;/span&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;VerifyVersionInfo(
      &amp;amp;osvi, 
      VER_MAJORVERSION | VER_MINORVERSION | 
      VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
      dwlConditionMask);
}&lt;/pre&gt;

&lt;p&gt;In this code you can see how we use the VerifyVersion with a set of conditions to return TRUE incase we run on any OS grater than Windows XP Service Pack 2.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;For .NET Framework developers, use the ==, !=, &amp;lt;=, &amp;lt;, &amp;gt;, &amp;gt;= operators of the &lt;b&gt;Version&lt;/b&gt; object returned by &lt;b&gt;Environment.OSVersion.Version&lt;/b&gt;:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// This code checks if the OS is at least Windows XP
  &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(Environment.OSVersion.Version &amp;lt; &lt;span style="color: blue"&gt;new &lt;/span&gt;Version(5, 1))
  {
        MessageBox.Show(&lt;span style="color: #a31515"&gt;&amp;quot;Windows XP or later required.&amp;quot;&lt;/span&gt;,
         &lt;span style="color: #a31515"&gt;&amp;quot;Incompatible Operating System&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK,
                MessageBoxIcon.Error);
        &lt;span style="color: blue"&gt;return&lt;/span&gt;;
  }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;It is highly recommended that you don’t check for version at all and try looking to work with features. It will prove valuable for the future…&lt;/p&gt;

&lt;p&gt;Just incase you want to read more, here are some useful links&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Application Compatibility Cookbook: &lt;a href="http://msdn.microsoft.com/en-us/library/bb963893.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb963893.aspx&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Version Lie and Managed Applications: &lt;a href="http://blogs.msdn.com/cjacks/archive/2007/09/10/version-lie-shims-and-managed-code-on-windows-vista.aspx"&gt;http://blogs.msdn.com/cjacks/archive/2007/09/10/version-lie-shims-and-managed-code-on-windows-vista.aspx&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also &lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples.AppCompat/VersionCHecking.zip" target="_blank"&gt;download a HOL and code sample for this topic&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=522166" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category></item><item><title>User Account Control Data Redirection</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/08/04/user-account-control-data-redirection.aspx</link><pubDate>Tue, 04 Aug 2009 19:27:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:521972</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=521972</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/08/04/user-account-control-data-redirection.aspx#comments</comments><description>&lt;p&gt;To making sure your application is ready (compatible) for Windows 7, I am going to start providing additional information about the few compatibility topics we introduced in the &amp;ldquo;&lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/07/23/is-your-application-ready-for-windows-7-rtm.aspx"&gt;Is Your Application Ready for Windows 7 RTM?&lt;/a&gt;&amp;rdquo; post. This post focuses UAC Virtualization or more known as Data Redirection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What Are You Talking About?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Today, many applications are still designed to write files to the Program Files, Windows directories, or system root (typically the C drive) folders. Some applications are designed to update Microsoft&amp;reg; Windows registry values, specifically values in HKLM/Software. But there is one problem: the files or registry values are not created or updated. You may ask, &amp;ldquo;What&amp;rsquo;s going on? My application goes through the code and does not report an error. So where are my files?&amp;rdquo; &lt;/p&gt;
&lt;p&gt;To be specific, you may experience one or more of the following symptoms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your application writes to Program Files, Windows directories, or the system root (typically the C drive) folders, but you can't find your files in these locations &lt;/li&gt;
&lt;li&gt;Your application writes to the Windows registry, specifically to HKLM/Software, but you can't see the registry updates &lt;/li&gt;
&lt;li&gt;You switch to another user account, and your application is unable to find files that were written to Program Files, Windows directories, or the system root (typically the C drive) folders, or it finds older versions of these files &lt;/li&gt;
&lt;li&gt;After turning User Account Control (UAC) on or off, your application is unable to find files in the Program Files or Windows directories &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If this happens to your application, it is experiencing &lt;strong&gt;UAC Virtualization&lt;/strong&gt; (AKA Data Redirection). The following information provides you with everything you need to know in order to detect this application compatibility problem, offers some solutions, and provides additional information about the specific nature of the compatibility problem.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Real Issue: UAC Virtualization&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Prior to Windows Vista, administrators typically ran applications. As a result, applications could freely read and write system files and registry keys. If standard users ran these applications, they would fail due to insufficient access. Windows Vista improved application compatibility for standard users by redirecting writes (and subsequent file or registry operations) to a per-user location within the user&amp;rsquo;s profile. &lt;/p&gt;
&lt;p&gt;For example, if an application attempts to write to C:\Program Files\Contoso\Settings.ini, and the user does not have permissions to write to that directory (the Program Files), the write operation will be &lt;strong&gt;redirected &lt;/strong&gt;to C:\Users\Username\AppData\Local\VirtualStore\Program Files\Contoso\settings.ini. If an application attempts to write to HKEY_LOCAL_MACHINE\Software\Contoso\ in the registry, it will automatically be &lt;strong&gt;redirected &lt;/strong&gt;to HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\Software\Contoso or HKEY_USERS\UserSID_Classes\VirtualStore\Machine\Software\Contoso.&lt;/p&gt;
&lt;p&gt;The following figure illustrates the two components of the Windows Virtualization process: file virtualization and registry virtualization:&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb756960.aspx"&gt;&lt;img height="291" width="315" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_4706E00C.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" /&gt;&lt;/a&gt; To learn more about UAC virtualization and new UAC technologies, see &amp;ldquo;New UAC Technologies for Windows Vista&amp;rdquo; at &lt;a href="http://msdn.microsoft.com/en-us/library/bb756960.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb756960.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Virtualization is intended only to &lt;strong&gt;assist&lt;/strong&gt; in application compatibility with existing programs. New applications designed for Microsoft Windows 7 &lt;b&gt;should NOT&lt;/b&gt; perform write operations to sensitive system areas, nor should they rely on virtualization to provide redress for incorrect application behavior. &lt;strong&gt;Always &lt;/strong&gt;develop applications for use with &lt;strong&gt;standard user &lt;/strong&gt;privileges and &lt;strong&gt;don&amp;rsquo;t &lt;/strong&gt;count on the application running under administrator privileges. Test your application with standard user privileges and not administrator privileges. &lt;/p&gt;
&lt;p&gt;If you are experiencing UAC virtualization with applications developed prior to Windows 7, re-design your applications to write files to the appropriate locations. When updating existing code to run on Windows 7, you should:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that during run-time, applications store data only in &lt;b&gt;per-user locations&lt;/b&gt; or in computer locations within %alluserprofile% that have properly set access control list (ACL) settings. For more information about ACLs, see &lt;a href="http://msdn.microsoft.com/en-us/library/aa374872.aspx"&gt;Access Control Lists&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Determine the known folder to which you want to write the data files. Generic data used by all users should be written to a global public location that is shared by all users. All other data should be written to a per-user location. 
&lt;ul&gt;
&lt;li&gt;Generic data files can include, but are not limited to log files, settings files (INI/XML), saved state applications such as saved games, and so on &lt;/li&gt;
&lt;li&gt;User documents are different; they should be saved to the Documents folder (or to a location the user specifies) &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ensure that you &lt;b&gt;do not&lt;/b&gt; hard-code paths once you have determined the appropriate locations. Instead, use one of the following programming models and APIs to retrieve the correct paths of specific Windows known folders: 
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;C/C++ native applications: &lt;/b&gt;Use the&lt;b&gt; &lt;/b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb762188(VS.85).aspx"&gt;&lt;b&gt;SHGetKnownFolderPath&lt;/b&gt;&lt;/a&gt; function that retrieves the full path of a known folder identified by the folder's &lt;a href="http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx"&gt;KNOWNFOLDERID&lt;/a&gt;, a GUID parameter indicating the known location you would like to obtain: 
&lt;ul&gt;
&lt;li&gt;FOLDERID_ProgramData &amp;ndash; Shared program data directory for all users &lt;/li&gt;
&lt;li&gt;FOLDERID_LocalAppData &amp;ndash; Per-user program data directory (non-roaming) &lt;/li&gt;
&lt;li&gt;FOLDERID_RoamingAppData &amp;ndash; Per-user program data directory (roaming) &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Managed Code&lt;/b&gt;: Use the &lt;a href="http://msdn.microsoft.com/en-us/library/system.environment.getfolderpath.aspx"&gt;&lt;b&gt;System.Environment.GetFolderPath&lt;/b&gt;&lt;/a&gt; function. &lt;b&gt;GetFolderPath&lt;/b&gt; takes a parameter indicating the Known Location you would like to obtain 
&lt;ul&gt;
&lt;li&gt;Environment.SpecialFolder.CommonApplicationData &amp;ndash; Shared program data directory for all users &lt;/li&gt;
&lt;li&gt;Environment.SpecialFolder.LocalApplicationData &amp;ndash; Per-user program data directory (non-roaming) &lt;/li&gt;
&lt;li&gt;Environment.SpecialFolder.ApplicationData &amp;ndash; Per-user program data directory (roaming) &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If none of the above-mentioned options are available, use the environment variable: 
&lt;ul&gt;
&lt;li&gt;%ALLUSERSPROFILE% &amp;ndash; Shared program data directory for all users &lt;/li&gt;
&lt;li&gt;%LOCALAPPDATA% &amp;ndash; Per-user program data directory (non-roaming) - Windows Vista or later &lt;/li&gt;
&lt;li&gt;%APPDATA% &amp;ndash; Per-user program data directory (roaming) - Windows Vista or later &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Steps to Determine the Most Appropriate Solution&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So far, we have presented the symptoms associated with UAC virtualization, explained why redirection is taking place, and suggested a solution. This section contains tests and procedures you should perform in order to pinpoint the real problem and plot a way to resolve it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test #1:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Launch the application with &lt;strong&gt;standard user&lt;/strong&gt; privileges &lt;/li&gt;
&lt;li&gt;Run through the scenario that results in a write operation to any given protected folder such as the Program Files or system root (C:\) directories &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Expected results:&lt;/b&gt; The application &amp;ldquo;succeeds&amp;rdquo; in writing the file to the protected folder; however, you can't find the file in the expected location &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conclusion:&lt;/b&gt; This suggests that UAC data virtualization is redirecting the file to a different location &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Test #2:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Using Windows Explorer, search for your files in the VirtualStore folder 
&lt;ul&gt;
&lt;li&gt;The VirtualStore folder is a folder in your profile which stores redirected files &lt;/li&gt;
&lt;li&gt;The VirtualStore folder&amp;rsquo;s name and location are subject to change in later versions of Windows &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;First, attempt to find it under %localappdata%\VirtualStore &lt;/li&gt;
&lt;li&gt;If you are unable to find it there, try issuing dir %userprofile%\yourfile.dat /s /a at a command line (usually found C:\Users\&amp;lt;user name&amp;gt;\AppData\Local\VirtualStore) &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Expected results:&lt;/b&gt; You should find your file at the virtual store folder or sub folders &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conclusion:&lt;/b&gt; This is proof that UAC virtualization is taking place &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Test #3&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log in as an administrator and launch your application with administrator privileges. 
&lt;ul&gt;
&lt;li&gt;To launch the application with administrator privileges, right-click the file executable and select &lt;b&gt;Run as Administrator&lt;/b&gt; &lt;/li&gt;
&lt;li&gt;When an application runs with administrator privileges, virtualization is turned off, and the application now has sufficient privileges to write to the protected folders &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Do not &lt;/strong&gt;rely on permanently marking your application to &lt;strong&gt;require &lt;/strong&gt;administrator privileges as a way to bypass virtualization, as doing so will leave the system more vulnerable to attack, will prevent the application from running with limited or standard user privileges, and will needlessly annoy users with a UAC prompt &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Expected results:&lt;/b&gt; The application succeeds in writing the file to the protected folder, and you can find the file at the expected location &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conclusion: &lt;/b&gt;Running the application with administrator privileges turns off virtualization and grants privileges &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Test #4&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Launch Process Monitor (ProcMon) 
&lt;ul&gt;
&lt;li&gt;To learn more about Process Monitor, visit the &lt;a target="_blank" href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;Windows Sysinternals Process Monitor Web site&lt;/a&gt; on Microsoft TechNet &lt;/li&gt;
&lt;li&gt;During the hands-on lab, we will walk you through a detailed step-by-step process to use Process Monitor &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Configure filtering to show only file operations and only those operations performed by your process 
&lt;ul&gt;
&lt;li&gt;When you launch Process Monitor, the Process Monitor Filter dialog box appears &lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add the following entry to the filter: "Column=Process Name, Relation=is, Value=YourApp.exe, Action=Include"&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_42242C50.png"&gt;&lt;img height="328" width="523" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_734366F0.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;To invoke the Process Monitor Filter dialog box again, click this toolbar button &lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_596F30C1.png"&gt;&lt;img height="26" width="26" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_0A8E6B62.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;After clicking OK, configure Process Monitor to log only file events by enabling the following toolbar buttons as shown: &lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_3F2EC79D.png"&gt;&lt;img height="28" width="138" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_57BE64ED.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Press CTRL-X to clear the log; press CTRL-E to toggle logging on/off &lt;/li&gt;
&lt;li&gt;Expected results: You will see file operations whose results are REPARSE; the next line (with result SUCCESS) will usually be the redirected operation: &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_704E023D.png"&gt;&lt;img height="295" width="526" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_28204661.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Double-click the line representing the operation with REPARSE as the result and click the &lt;b&gt;Stack&lt;/b&gt; tab to show the call stack at the time of the operation: &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_3BCD2FF5.png"&gt;&lt;img height="429" width="501" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_6156AD56.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The pink K and blue U letters on the left of each stack frame show whether the stack frame is in kernel mode (K) or in user mode (U);in this case, we are interested only in user-mode stack frames &lt;/li&gt;
&lt;li&gt;In this example, the SaveFile function (at frame 21) in BrokenAppNative.exe is the one performing the operation which will be redirected &lt;/li&gt;
&lt;li&gt;You should configure symbols for a more meaningful display' for more information about configuring symbols, refer to the &lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;Debugging Tools for Windows Web site&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conclusion:&lt;/b&gt; This test proves that UAC Virtualization did take place and shows you what operations in your application need to be corrected &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Task #5&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a manifest to your application which contains a UAC directive 
&lt;ul&gt;
&lt;li&gt;This will mark your application as UAC-aware and will disable UAC virtualization &lt;/li&gt;
&lt;li&gt;A manifest is an XML document that developers embed as a resource in a DLL or .exe file, but can be a standalone file named &lt;i&gt;YourApp.exe.manifest&lt;/i&gt; or &lt;i&gt;YourDLL.dll.manifest&lt;/i&gt; &lt;/li&gt;
&lt;li&gt;Manifests can contain a variety of information that usually pertains to application compatibility, such as the exact version of Visual C++ runtime to load, the version of Common Controls Library to load, as well as UAC settings &lt;/li&gt;
&lt;li&gt;Read more about UAC settings in the manifest in the &lt;a href="http://msdn.microsoft.com/en-us/library/bb756929.aspx"&gt;Windows Vista Developer Story: Create and Embed an Application Manifest (UAC)&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Expected results:&lt;/b&gt; The application now fails to write to any of the protected folders, returning an &amp;ldquo;access denied&amp;rdquo; error 
&lt;ul&gt;
&lt;li&gt;This is a &lt;strong&gt;GOOD&lt;/strong&gt; result, because the UAC data virtualization &lt;strong&gt;didn&amp;rsquo;t &lt;/strong&gt;kick into action &lt;/li&gt;
&lt;li&gt;As the developer, you should be able to recognize this (because you marked the application as UAC-aware in the manifest) and avoid writing to any of the protected areas &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Conclusion:&lt;/b&gt; Windows enables virtualization because the application isn&amp;rsquo;t marked as UAC-aware. Marking your application as UAC-aware disables virtualization. If your app tries to write to protected store while marked as UAC-aware, you will get an access denied exception &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Hands On Labs and Additional Material&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;you can &lt;a target="_blank" href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples.AppCompat/Data-Redirection.zip"&gt;download&lt;/a&gt; this doc, a presentation describing UAC Virtualization, and &lt;a target="_blank" href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples.AppCompat/Data-Redirection.zip"&gt;two full hands on labs on this topic&lt;/a&gt;, one for managed code and one for native, from &lt;a target="_blank" href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples.AppCompat/Data-Redirection.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tools &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In order to detect UAC virtualization we use the following tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Process Monitor&lt;/b&gt;, a free and advanced Microsoft tool that monitors and logs file system, registry, network, and process activity 
&lt;ul&gt;
&lt;li&gt;To learn more about Process Monitor, see the &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;Process Monitor page&lt;/a&gt; at the Windows Sysinternals Web site &lt;/li&gt;
&lt;li&gt;Download Process Monitor from &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;Microsoft TechNet&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Standard User Analyzer&lt;/b&gt;, part of the Microsoft Application Compatibility Toolkit, is a free tool that monitors resource (file, registry, and others) usage of a given application and reports activity that is responsible for Standard User problems 
&lt;ul&gt;
&lt;li&gt;To learn more about Standard User Analyzer see &lt;a href="http://technet.microsoft.com/en-us/library/cc766021.aspx"&gt;&amp;ldquo;Standard User Analyzer&amp;rdquo;&lt;/a&gt; at Microsoft TechNet &lt;/li&gt;
&lt;li&gt;To obtain Standard User Analyzer, &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=24da89e9-b581-47b0-b45e-492dd6da2971&amp;amp;displaylang=en"&gt;download the Microsoft Application Compatibility Toolkit&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Additional Resources&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows Vista Application Compatibility: UAC: Standard User Changes &amp;ndash; &lt;a href="http://msdn.microsoft.com/en-us/library/bb963893.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb963893.aspx&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Common file and registry virtualization issues in Windows Vista &amp;ndash; &lt;a href="http://support.microsoft.com/kb/927387"&gt;http://support.microsoft.com/kb/927387&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;New UAC Technologies for Windows Vista &amp;ndash; &lt;a href="http://msdn.microsoft.com/en-us/library/bb756960.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb756960.aspx&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Inside Windows Vista User Account Control &amp;ndash; &lt;a href="http://technet.microsoft.com/en-us/magazine/2007.06.uac.aspx"&gt;http://technet.microsoft.com/en-us/magazine/2007.06.uac.aspx&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=521972" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Labs/default.aspx">Labs</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Data+Redirection/default.aspx">Data Redirection</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/UAC+Virtualization/default.aspx">UAC Virtualization</category></item><item><title>Windows 7 Taskbar Dynamic Overlay Icons and Progress Bars</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/07/28/windows-7-taskbar-dynamic-overlay-icons-and-progress-bars.aspx</link><pubDate>Tue, 28 Jul 2009 17:31:22 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:520984</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=520984</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/07/28/windows-7-taskbar-dynamic-overlay-icons-and-progress-bars.aspx#comments</comments><description>&lt;p&gt;We covered the basics of the Windows 7 Taskbar in &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/06/18/developing-for-the-windows-7-taskbar-application-id.aspx" target="_blank"&gt;Developing for the Windows 7 Taskbar – Application ID&lt;/a&gt;&lt;i&gt;&lt;/i&gt;, and how you can create a Jump List for your application in &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/06/22/developing-for-the-windows-7-taskbar-jump-into-jump-lists-part-1.aspx" target="_blank"&gt;Developing for the Windows 7 Taskbar – Jump into Jump Lists – Part 1&lt;/a&gt;&lt;i&gt;&lt;/i&gt;, &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/06/25/developing-for-the-windows-7-taskbar-jump-into-jump-lists-part-2.aspx" target="_blank"&gt;Part 2&lt;/a&gt;&lt;i&gt;&lt;/i&gt;, &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/07/02/developing-for-the-windows-7-taskbar-jump-into-jump-lists-part-3.aspx" target="_blank"&gt;and Part 3&lt;/a&gt;&lt;i&gt;&lt;/i&gt;). In this post, we will explore how you can leverage the cool Taskbar functionality of dynamic overlay icons and multi-state progress bars.&lt;/p&gt;  &lt;p&gt;A central Windows 7 tenet is that the &amp;quot;User Is in Control&amp;quot;; that is, we empower users to take ownership of their desktop looks and functionality. From little things, like allowing users to arrange their Taskbar icons as they see fit, to enabling users to control the number of icons on the Taskbar. Windows 7 “removed” the System Tray Icon area. By default, almost all the tray icons are concealed. Consequently, it is safe to assume that large number of the notification balloons will also not be visible and most users will not see them. You can read more about the updates to the Notification Area &lt;a href="http://blogs.msdn.com/e7/archive/2008/09/29/follow-up-starting-launching-and-switching.aspx" target="_blank"&gt;here&lt;/a&gt;. To compensate for this lack of notification, Windows 7 Taskbar offers Overlay Icons and Progress Bars. By using overlay icons and progress bars, your application can provide contextual status information to the user in spite of the lack of a System Tray Icon area and even if the application’s window does not display. The user doesn’t even have to look at the thumbnail or the live preview of your app – the Taskbar button itself can reveal whether you have any interesting status updates. This functionality is part of our commitment to provide users with easily accessible information about an application's status without any extra clicking.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Overlay Icons&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/dd562040(VS.85).aspx" target="_blank"&gt;ITaskbarList4&lt;/a&gt; interface, specifically its &lt;a href="http://msdn.microsoft.com/en-us/library/dd391696(VS.85).aspx" target="_blank"&gt;SetOverlayIcon&lt;/a&gt; function, exposes &lt;a href="file:///C:\Users\v-sagold\AppData\Local\Temp\WindowsLiveWriter-429641856\supfiles10470B99\image12.png"&gt;&lt;/a&gt;the native overlay functionality. The function takes a window handle, an icon handle, and optional description text, as you can see in the following code snippet.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;HICON hIcon = NULL; &lt;span style="color: #008000"&gt;// for IDM_OVERLAY_CLEAR&lt;/span&gt;&lt;br /&gt;hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OVERLAY1));&lt;br /&gt;&lt;span style="color: #008000"&gt;// Set the window's overlay icon, possibly NULL value&lt;/span&gt;&lt;br /&gt;g_pTaskbarList-&amp;gt;SetOverlayIcon(hWnd, hIcon, NULL);&lt;br /&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (hIcon) {&lt;br /&gt;&lt;span style="color: #008000"&gt;// need to clean up the icon as we no longer need it&lt;/span&gt;&lt;br /&gt;DestroyIcon(hIcon);&lt;br /&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Make sure you obtain ITaskbarList3 *g_pTaskbarList = NULL;as we did before, and CoCreate it:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;CoCreateInstance(&lt;br /&gt;    CLSID_TaskbarList, &lt;br /&gt;    NULL, &lt;br /&gt;    CLSCTX_INPROC_SERVER, &lt;br /&gt;    IID_PPV_ARGS(&amp;amp;g_pTaskbarList));&lt;/pre&gt;
When running the above code in the proper context (you can download the application) the result looks like the following pictures. On the left, you see the application without any overlay icons, and on the right you can see the application with a red icon overlay.&lt;/div&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_65EF7F14.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_56D8A03A.png" width="546" height="186" /&gt;&lt;/a&gt; The managed wrapper for this feature resides in the Taskbar class that is part of the Windows API Code Pack for the .NET Framework. All that you need to do is use the &lt;b&gt;OverlayImage &lt;/b&gt;property (Taskbar.OverlayImage). Simply call: &lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;Taskbar.OverlayImage = &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OverlayImage(TaskbarDemo.Properties.Resources.Red, &lt;span style="color: #006080"&gt;&amp;quot;Red&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Doing so allows you to provide an OverlayImage for the taskbar button. The TaskbarDemo project is a WinForms demo, and you can find the above code in the TaskbarDemoMainForm.cs. &lt;/p&gt;

&lt;p&gt;It’s equally easy to provide an extension method that does this to a WPF &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.window.aspx" target="_blank"&gt;Window&lt;/a&gt;. Note that the only thing that you need to do is get the right icon, which is easy using .NET resources. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Progress Bars&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you already use a standard progress bar in your application’s top level window, the DMW will pick it up and, by default, display its progress as an overlay on top of your application. However, you can programmatically control the progress bar behavior on your application’s icon. &lt;/p&gt;

&lt;p&gt;&lt;a href="file:///C:\Users\v-sagold\AppData\Local\Temp\WindowsLiveWriter-429641856\supfiles10470B99\image18.png"&gt;&lt;/a&gt;The native functionality is again found in the &lt;em&gt;ITaskbarList3 &lt;/em&gt;interface, this time in the &lt;a href="http://msdn.microsoft.com/en-us/library/dd391697(VS.85).aspx" target="_blank"&gt;SetProgressState&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd391698(VS.85).aspx" target="_blank"&gt;SetProgressValue&lt;/a&gt; functions. The functions are quite self-explanatory. You can set the progress bar’s state (SetProgressState) to, for example, indeterminate or error, and use SetProgressValue to set the progress value. The following code snippet illustrates how to use these functions:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;case&lt;/span&gt; WM_TIMER:&lt;br /&gt;    g_nProgress++;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (g_nProgress == 1)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;// First time through, so we'll set our progress state&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// to be indeterminate - this simulates a background &lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// computation to figure out how much progress we'll need.&lt;/span&gt;&lt;br /&gt;        g_pTaskbarList-&amp;gt;SetProgressState(hWnd, TBPF_INDETERMINATE);&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (g_nProgress == MAX_PROGRESS_IND)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;// Now set the progress state to indicate we have some &lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// normal progress to show.&lt;/span&gt;&lt;br /&gt;        g_pTaskbarList-&amp;gt;SetProgressValue(hWnd, 0, MAX_PROGRESS_NORMAL);&lt;br /&gt;        g_pTaskbarList-&amp;gt;SetProgressState(hWnd, TBPF_NORMAL);&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (g_nProgress &amp;gt; MAX_PROGRESS_IND)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (g_nProgress - MAX_PROGRESS_IND &amp;lt;= MAX_PROGRESS_NORMAL)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Now show normal progress to simulate a background &lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// operation&lt;/span&gt;&lt;br /&gt;            g_pTaskbarList-&amp;gt;SetProgressValue(&lt;br /&gt;                                hWnd, &lt;br /&gt;                                g_nProgress - MAX_PROGRESS_IND, &lt;br /&gt;                                MAX_PROGRESS_NORMAL);&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Progress is done, stop the timer and reset progress &lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// state&lt;/span&gt;&lt;br /&gt;            KillTimer(hWnd, g_nTimerId);&lt;br /&gt;            g_nTimerId = 0;&lt;br /&gt;            g_pTaskbarList-&amp;gt;SetProgressState(hWnd, TBPF_NOPROGRESS);&lt;br /&gt;            MessageBox(hWnd, L&lt;span style="color: #006080"&gt;&amp;quot;Done!&amp;quot;&lt;/span&gt;, L&lt;span style="color: #006080"&gt;&amp;quot;Progress Complete&amp;quot;&lt;/span&gt;, MB_OK);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Note that on the first timer tick, we set the progress bar to TBPF_INDETERMINATE, and only after that did we set it to TBPF_NORMAL, which set the progress indicator to grow in size from left to right in proportion to the estimated amount of the operation completed.&lt;/p&gt;

&lt;p&gt;For managed code, we use the Windows Code Pack API. Much like the native progress bar, the managed code &lt;b&gt;Taskbar&lt;/b&gt; class includes a progress bar property (it is in its own a class), which allows you to set current value, max value, and statethe progress bar state. The progress bar states (found in the TaskbarButtonProgressState class) are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;NoProgress –equal to the TBPF_NOPROGRESS native state &lt;/li&gt;

  &lt;li&gt;Indeterminate –equal to the TBPF_INDETERMINATE native state &lt;/li&gt;

  &lt;li&gt;Normal –equal to the TBPF_NORMAL native state &lt;/li&gt;

  &lt;li&gt;Error –equal to the TBPF_ERROR native state &lt;/li&gt;

  &lt;li&gt;Paused –equal to the TBPF_PAUSED native state &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find a WinForms demo in the TaskbarDemo project and in the TaskbarDemoMainForm.cs, you can find the UpdateProgressBar function that is called by a timer to update the progress bar.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;Taskbar.ProgressBar.State = &lt;br /&gt;    (TaskbarButtonProgressState)Enum.Parse(&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(TaskbarButtonProgressState), &lt;br /&gt;            (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;)comboBoxProgressBarStates.SelectedItem);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Taskbar.ProgressBar.State != TaskbarButtonProgressState.Indeterminate)&lt;br /&gt;    Taskbar.ProgressBar.CurrentValue = progressBar1.Value;&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;As you can see, the code enables you to choose the state of the progress bar. Changing it to the error state turns the color of the progress bar on the Taskbar Icon to red.&lt;/p&gt;

&lt;p&gt;The icing on the Taskbar progress bar &amp;quot;cake&amp;quot; is that you get this functionality FOR FREE if you use the standard progress dialog for file operations. (As we advance in this series, you’ll see that you get lots of functionality for free if you follow the standard guidelines of Windows programming.) For example, if you invoke a file operation using the &lt;a href="http://msdn.microsoft.com/en-us/library/bb762164(VS.85).aspx"&gt;SHFileOperation&lt;/a&gt; API or &lt;a href="http://msdn.microsoft.com/en-us/library/bb775771(VS.85).aspx"&gt;IFileOperation&lt;/a&gt; interface, the Taskbar button progress bar automatically displays the progress information (including errors) of that operation. This is what Windows Explorer does with great success. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2009/02/16/windows-7-taskbar-overlay-icons-and-progress-bars.aspx"&gt;Original&lt;/a&gt; post from &lt;a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2009/02/16/windows-7-taskbar-overlay-icons-and-progress-bars.aspx"&gt;Sasha Goldstein&lt;/a&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;br /&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=520984" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Taskbar/default.aspx">Taskbar</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Source+Code/default.aspx">Source Code</category></item><item><title>Is Your Application Ready for Windows 7 RTM?</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/07/23/is-your-application-ready-for-windows-7-rtm.aspx</link><pubDate>Thu, 23 Jul 2009 08:29:02 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:520121</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>48</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=520121</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/07/23/is-your-application-ready-for-windows-7-rtm.aspx#comments</comments><description>&lt;p&gt;Yesterday Windows 7 completed a major milestone--&lt;a href="http://windowsteamblog.com/blogs/windows7/archive/2009/07/22/windows-7-has-been-released-to-manufacturing.aspx" target="_blank"&gt;release to manufacturing&lt;/a&gt; (RTM)! And in three months time – on October 22&lt;sup&gt;nd&lt;/sup&gt; – Windows 7 will be available for everyone to enjoy. Excitement about the upcoming public release of Windows 7 has been growing for months and expectations are for a much quicker adoption rate than what we saw with the previous Windows version. &lt;/p&gt;  &lt;p&gt;As we approach October 22&lt;sup&gt;nd&lt;/sup&gt; you need to ask yourself: Is your application ready for Windows 7? What will happen when end users install your application on Windows 7? Will your application run? Will your application behave like a Windows 7 first class citizen? Will users see any difference when running applications on Windows 7 versus Windows Vista or XP? October 22&lt;sup&gt;nd&lt;/sup&gt; is just around the corner and we are here to help you answer, “&lt;b&gt;YES!&lt;/b&gt;” to these questions and&lt;b&gt; &lt;/b&gt;be able to&lt;b&gt; &lt;/b&gt;state with confidence that, &lt;b&gt;“Absolutely, my application &lt;i&gt;rocks&lt;/i&gt; on Windows 7&lt;/b&gt;.” We want to help your users get the best possible Windows 7 experience from your application starting on Day 1.&lt;/p&gt;  &lt;p&gt;All this sounds great, but what steps do you need to take in order to be able to say: “Yes my application is a first-class Windows citizen”? Is there a check list? You bet!&lt;/p&gt;  &lt;p&gt;You need to do three things to ensure a smooth transition:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Make sure your application is Windows 7 compatible &lt;/li&gt;    &lt;li&gt;Optimize your application experience and performance for Windows 7 &lt;/li&gt;    &lt;li&gt;Provide new and exciting user experiences with Windows 7&amp;#160; &lt;/li&gt; &lt;/ol&gt;  &lt;ol&gt;&lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Make sure your application is Windows 7 compatible&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Before considering using any new Windows 7 features, make sure your application is compatible with Windows 7. There is no escape from this; it is essential that you make sure that your application runs well on Windows 7. There is nothing worse for an end user than to be excited about the new Windows 7 operating system just to discover that a favorite application doesn’t perform properly. A bad user experience hurts everyone--which is why you have to make sure your application installs and runs on all Windows 7 versions (including E - &lt;i&gt;&lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/07/13/windows-7-e-best-practices-for-isvs.aspx"&gt;Windows 7 E Best Practices for ISVs&lt;/a&gt;&lt;/i&gt;) and supports both 32- and 64-bit versions. &lt;/p&gt;  &lt;p&gt;If your application is compatible with Windows Vista you are in a good shape! We expect most applications that run on Windows Vista to run on Windows 7. Obviously, you can’t take this for granted and must check (and double check) that your application truly is compatible with Windows 7. There are a few differences between Windows Vista and Windows 7 that can affect specific application functions, so if you haven’t checked the &lt;a href="http://code.msdn.microsoft.com/Windows7AppQuality"&gt;&lt;i&gt;Windows 7 Quality Cookbook&lt;/i&gt;&lt;/a&gt; lately, we highly recommend that you do so. &lt;/p&gt;  &lt;p&gt;If your application was designed for Windows XP (or earlier Windows versions), and you haven't confirmed its compatibility with Windows Vista, there are a few areas (for example, UAC), that you should especially note. It is important to keep in mind that there is no one silver bullet for application compatibility issues. Each application comes with its own set of issues that are dependent on specific implementation details. The &lt;a href="http://msdn.microsoft.com/library/bb757005"&gt;&lt;i&gt;Windows Vista Application Compatibility Cookbook&lt;/i&gt;&lt;/a&gt; is still very relevant for Windows 7, as 99% of its topics apply to Windows 7. With that said, a few topics rise above the others. The following seven areas represent about a large number of the reported application compatibility problems.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Version Checking&lt;/b&gt; – by far the top application compatibility problem. Ever get a message from an application saying, “Requires Windows XP or higher” when you are running on Windows 7? If so, you hit a version checking issue. You can read more about this topic - &lt;a href="http://msdn.microsoft.com/en-us/library/bb756927.aspx" target="_blank"&gt;Application Compatibility: Operating System Versioning&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Data Redirection&lt;/b&gt; – beginning with Windows Vista, standard users have restricted access to certain files, folders, and registry keys. When an application is trying to write to these locations, it gets redirected to somewhere else. Most of the time this is transparent to both users and application developers, but sometimes it is not and that lead to some very interesting results. You can read about this topic - &lt;a href="http://support.microsoft.com/kb/927387" target="_blank"&gt;Common file and registry virtualization issues in Windows Vista&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;b&gt;IE Protected Mode &lt;/b&gt;– starting with Windows Vista, by default IE runs with lower privileges. This usually means that some ActiveX controls that work on Windows XP don’t work on Windows Vista and Windows 7. Need more information, you can read &lt;a href="http://blogs.msdn.com/ie/archive/2006/02/09/528963.aspx" target="_blank"&gt;Protected Mode in Vista IE7&lt;/a&gt; (and yes this is still applicable for IE8.) &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Session 0 Isolation&lt;/b&gt; - in Windows Vista, services run in their own session (session 0) and not in the user session(s) (session 1 and above). This security boundary protects the system from many vicious attack vectors and is absolutely necessary. However, it also introduces communication problems between services and application like blocking your messages! You can read more about this topic -&amp;#160; &lt;a href="http://blogs.msdn.com/cjacks/archive/2006/10/24/modifying-the-mandatory-integrity-level-for-a-securable-object-in-windows-vista.aspx" target="_blank"&gt;Modifying the Mandatory Integrity Level for a Securable Object in Windows Vista&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Installer Detection&lt;/b&gt; – starting with Windows Vista, the OS automatically tries to detect if a given application is an installer application, which usually means that the application requires elevation to administrator privileges. However, sometimes these heuristics can cause problems. Interested in additional information, read about &lt;a href="http://msdn.microsoft.com/en-us/library/aa905330.aspx" target="_blank"&gt;The Windows Vista and Windows Server® 2008 Developer Story&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;b&gt;User Interface Privilege Isolation&lt;/b&gt; – this prevents an application (process) from sending messages to another process with higher privileges even if running under the same user's account. While this protects from shatter attacks, it can also break some applications. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;High DPI&lt;/b&gt; –during install, Windows 7 automatically detects whether your screen supports High DPI. If it does, Windows 7 automatically sets the screen resolution to High DPI. If your application is not High DPI aware, this may cause some display issues (like text clipping). Read more about &lt;a href="http://msdn.microsoft.com/en-us/library/dd756693(VS.85).aspx" target="_blank"&gt;Ensuring your application displays properly on High-DPI Displays&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In the following weeks, we will address in detail each of the above topics to help you get ready for Windows 7.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Optimize your application experience and performance for Windows 7&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;After verifying that your application can install and run on Windows 7 without any problems, it is time to step up and optimize your application’s user experiences and performance while running on Windows 7. Do this by taking advantage of the great new features offered with Windows 7. These include new user interface innovations like the Taskbar and Libraries, to more fundamental features like Trigger Start Services or the new Troubleshooting platform. By optimizing your application for Windows 7, you can make sure that your end user's experiences when running your application on Windows 7 surpasses their expectations. Users will expect applications to work properly with the Taskbar (just one example); but if your application is not optimized for the new Windows 7 Taskbar experience, end users might just notice that. &lt;/p&gt;  &lt;p&gt;When you're ready to optimize your application for Windows 7, you might consider using one or more of the following features:&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="20" width="580"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="370"&gt;         &lt;ul&gt;           &lt;li&gt;&lt;b&gt;Taskbar &lt;/b&gt;– The new Taskbar in Windows 7 provides more information to the user in more intuitive ways, with features like Jump Lists that helps users quickly “jump” into where they want to go. You can read more &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/06/18/developing-for-the-windows-7-taskbar-application-id.aspx"&gt;Developing for the Windows 7 Taskbar – Application ID&lt;/a&gt;. &lt;/li&gt;            &lt;li&gt;&lt;b&gt;Libraries &lt;/b&gt;–&lt;b&gt; &lt;/b&gt;Libraries are the primary entry points to user data in Windows 7. A Windows 7 Library is a user-defined collection of content that represents the user’s data independently from the folder hierarchy. Users can unify and flatten the folder hierarchy by aggregating any number of physical locations (on their local machine or on remote machines) into a single view – which is the library. You can read more - &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/06/11/windows-7-programming-guide-libraries.aspx"&gt;Windows 7 Programming Guide – Libraries&lt;/a&gt;. &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;        &lt;td valign="top" width="210"&gt;         &lt;br /&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_0C2CB989.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_7D15DAAE.png" width="205" height="319" /&gt;&lt;/a&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Trigger Start Services&lt;/b&gt; – The Windows 7 Service Control Manager has been extended so that a service can be automatically started and stopped when a specific system event, or trigger, occurs on the system. Trigger-start capabilities remove the need for services to start up automatically at computer startup and then poll or wait for an event to occur, such as a device arrival. More about this topic – &lt;a href="http://msdn.microsoft.com/en-us/library/dd405513(VS.85).aspx" target="_blank"&gt;Service Trigger Events&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Power Optimization&lt;/b&gt; – Windows 7 provides the infrastructure and tools that make it easy for developers to determine the energy impact of their applications. A set of event callbacks enable applications to reduce their activity when the system is on battery power and automatically scale up when the system is on AC power.&lt;b&gt;&lt;/b&gt; &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Troubleshooting Platform &lt;/b&gt;– Windows 7 delivers a comprehensive and extensible Troubleshooting Platform that uses a PowerShell-based mechanism to troubleshoot and resolve problems. The Troubleshooting Platform seamlessly integrates with the Windows 7 PC Solution Center, enabling other applications to execute diagnostics in a similar manner as part of their PC management regimen. Read more about &lt;a href="http://msdn.microsoft.com/en-us/library/dd323778(VS.85).aspx" target="_blank"&gt;Windows Troubleshooting Platform&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_3C075B4A.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_1B13E8A3.png" width="350" height="268" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Windows Error Reporting &lt;/b&gt;- Windows Error Reporting (WER) is a set of Windows technologies that capture software crash data and support end-user reporting of crash information. Through Winqual services, software and hardware vendors can access reports in order to analyze and respond to these problems. This set of tools provides amazing real-time information about the quality of your software and can help facilitate software updates and patches. &lt;a href="http://www.microsoft.com/whdc/maintain/StartWER.mspx" target="_blank"&gt;Get Started with Windows Error Reporting&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;I/O Optimization&lt;/b&gt; – I/O prioritization improves the responsiveness of the system without significantly decreasing the throughput of the system. If you have any I/O-bound long services that you can run in the background, the user will be thankful. Non-I/O optimized applications tend to hug the I/O and put an extra burden on the system. If your application optimizes the I/O for non critical application services, it can dramatically improve the overall system behavior. &lt;b&gt;&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;&lt;b&gt;Restart Manager&lt;/b&gt; – This technology allows automatic post-crash restarts as well as application and operating system updates without rebooting the entire machine. When you implement this functionality, you get a second chance to save critical information if your application crashes. Windows will automatically restart your application and try to reload the information the user just used. This same technology facilitates updating most applications and the operating system without the need to reboot. If a reboot is needed, then Windows will make sure your application restarts and returns to its latest state &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Provide new and exciting user experiences with Windows 7&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Once your application has passed the first two steps, you can really differentiate your it by creating new and exciting user experiences. Windows 7 enables developers to create distinctive and intuitive applications that significantly enhance discoverability, usability, and sheer enjoyment. New methods of desktop integration put application functionality right at the user’s fingertips. New Touch APIs enable natural interactions through multitouch and finger-panning gestures. Rapid advances in hardware and software technology are also driving higher-fidelity user experiences. Windows 7 brings these advances under developer control with new and flexible APIs that take full advantage of the technology, while making it even easier to develop compelling applications.&lt;/p&gt;  &lt;p&gt;Windows 7 includes many new features that can make your application shine, raising it above the competition. When you think about creating new and exciting user experiences, consider using one or more of the following features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Ribbon&lt;/b&gt; – Windows 7 features the Ribbon interface from Office 2007 throughout the operating system, enabling improved user interface development on the platform. This means that developers can eliminate much of the drudgery of Win32 UI development and deliver a rich, graphical, animated, and highly familiar user interface by using the markup-based UI and a small, high-performance, native code runtime. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_20EE8C3C.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_3911F697.png" width="565" height="68" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Multitouch&lt;/b&gt;&amp;#160;&lt;b&gt;&amp;amp; Ink&lt;/b&gt; – Windows 7 features improved touch and gesture support, empowering developers to quickly and easily create unique application experiences that go beyond simple mouse pointing, clicking, and dragging. The new multi-touch APIs support rich gestures, such as pan, zoom, and rotate. All gestures provide direct visual feedback, and interact with underlying content in a natural and intuitive manner. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Sensor and Location Platform&lt;/b&gt; - Windows 7 has changed how developers use sensors. It includes native support for sensors, expanded by a new development platform for working with sensors, including location sensors (such as GPS devices) and sensors (such as an ambient light sensor or a temperature gauge), to create environmental awareness in Windows applications. Location sensors can unlock new opportunities for location-based services. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;New Graphics Stack&lt;/b&gt; – Windows 7 puts new graphics capability into the hands of application developers through a new set of DirectX APIs. Win32 developers can take advantage of the latest innovations in GPUs to add fast, scalable, high-quality, 2D and 3D graphics, text, and images to their applications. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_460BD6A8.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_453370BE.png" width="240" height="198" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Media Platform&lt;/b&gt; – Media Foundation and DirectShow® provide the basis for media support in Windows. Media Foundation was introduced in Windows Vista as the replacement for DirectShow. In Windows 7, Media Foundation has been enhanced to provide better format support, including:       &lt;ul&gt;       &lt;li&gt;MPEG-4, &lt;/li&gt;        &lt;li&gt;Support for video capture devices and hardware codecs, including H.264 video, MJPEG, and MP3 &lt;/li&gt;        &lt;li&gt;New sources for MP4, 3GP, MPEG2-TS, and AVI &lt;/li&gt;        &lt;li&gt;New file sinks for MP4, 3GP, and MP3 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And for developers Windows 7 adds new high-level APIs that make it much simpler to write media applications. &lt;/p&gt;  &lt;li&gt;&lt;b&gt;Federated Search&lt;/b&gt; – Windows 7 supports searching for documents beyond the user’s own PC. Developers and IT professionals can enable their search engines, document repositories, Web applications, and proprietary data stores to be searched from Windows 7 without needing to write and deploy client code. This enables end users to search their corporate intranet or the Web as easily as they can search their local files—all from within the same familiar Windows interface. &lt;/li&gt;  &lt;li&gt;&lt;b&gt;Device Stage Integration&lt;/b&gt; – Windows 7 combines software and services to create exciting new experiences for mobile phones, portable media players, cameras, and printers. Windows 7 makes it easier to use these devices directly from the Windows desktop. It also provides device makers with prominent placement on the Windows desktop, with branding opportunities and a simple interface for presenting the functionality and services that the device supports.     &lt;p&gt;&lt;/p&gt;    &lt;p&gt;I hope this post give you enough to start work with, making sure your application rocks on Windows 7!&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt; &lt;/li&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=520121" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Multi-Touch/default.aspx">Multi-Touch</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Taskbar/default.aspx">Taskbar</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sensor+and+Location/default.aspx">Sensor and Location</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Libraries/default.aspx">Libraries</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/ETW/default.aspx">ETW</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Source+Code/default.aspx">Source Code</category></item><item><title>7 Ways to Get Free Tickets to PDC 2009 Plus up to $17,777</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/07/14/7-ways-to-get-free-tickets-to-pdc-2009-plus-up-to-17-777.aspx</link><pubDate>Tue, 14 Jul 2009 20:16:50 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:518731</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>33</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=518731</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/07/14/7-ways-to-get-free-tickets-to-pdc-2009-plus-up-to-17-777.aspx#comments</comments><description>&lt;p&gt;Do you want to win a free trip to Los Angeles and a free ticket to PDC 2009? Do you think you have what it takes to win $17,777? Do you think you can write an amazing Windows 7 application?&lt;/p&gt;  &lt;p&gt;Well, if your answer to any of the above question is &amp;quot;Yes!&amp;quot; then say hello to the &lt;a href="https://www.code7contest.com/"&gt;Code&lt;sup&gt;7&lt;/sup&gt; Contest&lt;/a&gt;. The Code&lt;sup&gt;7&lt;/sup&gt; contest is where your application design ingenuity gives you the opportunity to get millions of eyes on your work, plus a trip to LA for PDC09, and up to &lt;b&gt;$17,777 in cash!&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/clip_5F00_image002_5F00_6FD1F86B.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/clip_5F00_image002_5F00_thumb_5F00_0F80D234.jpg" width="538" height="307" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Code&lt;sup&gt;7&lt;/sup&gt; is a special coding contest for developers. It is a great opportunity to show the world your creativity and coding powers. It is a way for you to cash in on your knowledge and skills. &lt;/p&gt;  &lt;p&gt;This is not just another standard code contest; this contest gives the finalists the opportunity to present their application at PDC 2009 in LA. The first prize is a real gem: $17,777 in cash, the opportunity to present the application to Microsoft executives at PDC 2009, plus worldwide interest in your application including a massive “marketing bump” for your application.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;To enter, you must: &lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Build an original, consumer-oriented client application prototype that runs natively on Windows 7 (for example Win32, WPF, MFC or WinForms – not an Air application or just a gadget) and addresses one or more of the following topic categories: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Simplify My Life &lt;/li&gt;    &lt;li&gt;More Media, More Places &lt;/li&gt;    &lt;li&gt;Gaming &lt;/li&gt;    &lt;li&gt;Work From Anywhere &lt;/li&gt;    &lt;li&gt;Safeguard Your Work &lt;/li&gt;    &lt;li&gt;Applications for a Better Tomorrow &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The application &lt;b&gt;must&lt;/b&gt; use at least one of the following Windows 7 technology features; however, judging will give more weight to entries that take advantage of more than one of these features: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Libraries &lt;/li&gt;    &lt;li&gt;Windows Touch &lt;/li&gt;    &lt;li&gt;Shell Integration &lt;/li&gt;    &lt;li&gt;DX11 (DirectX 11) &lt;/li&gt;    &lt;li&gt;Sensor and Location Platform &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So if you have being following my blog you have some advantage. &lt;/p&gt;  &lt;p&gt;The contest has several stages and few rules you need to be aware of:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;To enter this contest you must create and submit a &lt;b&gt;video&lt;/b&gt; in which you describe and demonstrate your application. &lt;/li&gt;    &lt;li&gt;The &lt;strong&gt;first qualifying&lt;/strong&gt; round starts at 12:00 a.m. Pacific Time (PT) on &lt;strong&gt;July 13, 2009&lt;/strong&gt;, and ends at 11:59 p.m. PT on &lt;strong&gt;October 10, 2009&lt;/strong&gt; (“Entry Period”). You will be able to able to submit your video until &lt;strong&gt;midnight October 10, 2009&lt;/strong&gt;. Your entry will be included in a pool with all eligible entries based on your geographical region. &lt;/li&gt;    &lt;li&gt;Entries received by 11:59 p.m. PT on &lt;strong&gt;August 15, 2009&lt;/strong&gt;, will be eligible to win an “Early Bird” prize described in the Winner Determination section below. &lt;/li&gt;    &lt;li&gt;Following the close of the first qualifications, a panel of judges will select two runner-up winners and one Finalist from each Region. &lt;/li&gt;    &lt;li&gt;Following judging, Microsoft will notify all winners and finalists and provide instructions for submitting their applications for evaluation. &lt;/li&gt;    &lt;li&gt;Finalists will be invited to present their applications to a panel of judges at the Microsoft Partner Developer Conference 2009 (PDC09) in Los Angeles, CA, USA. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For the complete contest rules and legal notice, please refer to the “RULES” section on the Code7 Contest Web site - &lt;a href="https://www.code7contest.com/"&gt;https://www.code7contest.com/&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;So, what are you waiting for? Get going and start working on your Windows 7 application!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=518731" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Multi-Touch/default.aspx">Multi-Touch</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Taskbar/default.aspx">Taskbar</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sensor+and+Location/default.aspx">Sensor and Location</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Libraries/default.aspx">Libraries</category></item><item><title>Windows 7 E Best Practices for ISVs</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/07/13/windows-7-e-best-practices-for-isvs.aspx</link><pubDate>Mon, 13 Jul 2009 12:31:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:518425</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>33</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=518425</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/07/13/windows-7-e-best-practices-for-isvs.aspx#comments</comments><description>&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Verdana','sans-serif'; font-size: 9pt;"&gt;We are intent on providing people with the best possible experience using their PCs with Windows. Building on that important principle, &lt;b&gt;we will ship the same version of Windows 7 in Europe as in rest of the world on the &amp;nbsp;worldwide launch date of 22 October, 2009. This version of Windows 7 includes Windows Internet Explorer 8 to help people get the most from their PCs and the Internet&lt;/b&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'Verdana','sans-serif'; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: HE;"&gt;We will not ship E editions of Windows 7, which would not have included Internet Explorer.&amp;nbsp; Customers who pre-order Windows 7 will receive versions of the product that include Internet Explorer. Customers participating in the Windows Upgrade Option available with select new PCs running Windows Vista will also receive versions of Windows 7 that include Internet Explorer.&amp;nbsp; &lt;span style="color: #333333;"&gt;Customers in Europe will also be able to choose between upgrade and full versions of Windows 7.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I asked &lt;/em&gt;&lt;a href="http://blogs.msdn.com/giorgio/"&gt;&lt;em&gt;Giorgio Sardo&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, to write about the E editions for Windows 7 and the changes developers need to be aware of. Since the E edition for Windows 7 will ship without&amp;nbsp; Internet Explorer 8. Giorgio is the Technical Evangelist working on IE and other web technologies. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Yochay&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In a &lt;a href="http://microsoftontheissues.com/cs/blogs/mscorp/archive/2009/06/11/working-to-fulfill-our-legal-obligations-in-europe-for-windows-7.aspx"&gt;previous post&lt;/a&gt;, we explained how Microsoft is working to fulfill our legal obligations in Europe for Windows 7. In the meantime, we received some questions about what the E editions of Windows 7 will mean for ISVs and developers.&lt;/p&gt;
&lt;p&gt;I took the most common questions and posed them to Arik Cohen, a Program Manager who is working on the E editions of Windows 7. If you have other questions about how this could affect your applications, please add your comments to the post to let us know and we&amp;rsquo;ll work to get your questions answered.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; What are the differences between standard editions of Windows 7 and E editions of Windows 7?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; The only functional difference is that the Internet Explorer 8 component is not available. This is the same component that your users can turn off in the &amp;ldquo;Turn Windows features on and off&amp;rdquo; control panel in the Windows 7 RC build. The Internet Web Platform components (for example, WebOC) are still installed and available on all editions of Windows 7, since they are part of the Windows core.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_28EE22EF.png"&gt;&lt;img height="375" width="429" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_52EE2117.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; How should I test my application to ensure that it will work without IE?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; To get the same functional behavior as a clean install of the E editions of Windows 7, go to &amp;ldquo;Turn Windows features on and off&amp;rdquo; dialog and uncheck Internet Explorer 8. We recommend testing your application both without a browser installed and with a browser installed (remember to set the installed browser as the default).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; What happens if I try to open a link without a browser installed?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; You will get an &amp;ldquo;Application not found&amp;rdquo; exception.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_06B61769.png"&gt;&lt;img height="173" width="370" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_2A030C0E.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;What general impacts of Windows 7 E editions have you seen on applications &amp;ndash; especially ones that rely on the WebOC?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; During our application compatibility testing, we&amp;rsquo;ve found that the vast majority of applications work on Windows 7 E editions without any changes. This includes applications that use many of the Internet Web Platform embedding methods (including WebBrowser control, hosting Trident, and HTML Help). &lt;/p&gt;
&lt;p&gt;For instance, the following screenshot shows a .NET application that embeds the WebBrowser control running correctly on the E edition of Windows 7.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_102ED5DF.png"&gt;&lt;img height="422" width="561" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_233FDCBE.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; My Windows application (WPF, Win Forms, Java, etc.) uses the Web Browser control. Is there any compatibility issue?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Everything should work as expected. However, we&amp;rsquo;ve seen some issues when applications depend directly on a specific browser. In particular, if while using the Web Browser control, you allow the application to open new windows that do not respect the user&amp;rsquo;s default browser choice, you may see some issues.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; What are the most common issues that you have found in your testing of applications? And what do you recommend ISVs do about them?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; I have seen applications encounter three classes of issues on E editions of Windows 7:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The application has hard coded dependencies to launch Internet Explorer when starting a browser to access the net. This is normally done by explicitly launching &amp;ldquo;&lt;strong&gt;&lt;em&gt;iexplore.exe &lt;a href="http://contoso.com"&gt;http://contoso.com&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&amp;rdquo; rather than running a &lt;strong&gt;ShellExecute &lt;/strong&gt;on &lt;a href="http://contoso.com"&gt;http://contoso.com&lt;/a&gt;. This generates an exception on a Windows 7 system without IE installed and enabled. There are times when this is intentional (for example, the Web site you are opening is only supported on IE), in which case you probably want to check for IE availability and provide a good error message to the user if it&amp;rsquo;s not available. &lt;br /&gt;&lt;br /&gt;We&amp;rsquo;ve seen this many times, especially in instances where the desired behavior is to open the application in the user&amp;rsquo;s default browser. You will need to switch to using the more generic case for these scenarios. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;The application allows launching a new window from within the WebBrowser control (for example, user accesses &amp;ldquo;Open in New Window&amp;rdquo; via the content menu, the page does a window.open() call, etc.).
&lt;p&gt;These links would always have opened in IE (regardless of the default browser on the system). If you designed your application to open in the default browser, you will need to provide a function that allows that. &lt;/p&gt;
&lt;p&gt;The recommended way to implement custom behavior when opening a new window is to use the &lt;a href="http://msdn.microsoft.com/en-us/library/aa768337(VS.85).aspx"&gt;NewWindow3&lt;/a&gt; event. Sample code to hook this up in a C# .NET application would look like the following examples.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;In the form initialization code:&lt;/b&gt;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;divre id="codeSnippet" style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;/divre&gt;webBrowser1.Navigate(&lt;span style="color: #006080;"&gt;"about:blank"&lt;/span&gt;);&lt;br /&gt;SHDocVw.WebBrowser web1 = &lt;br /&gt;(SHDocVw.WebBrowser)webBrowser1.ActiveXInstance;&lt;br /&gt;&lt;br /&gt;web1.NewWindow3 += &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt; SHDocVw.DWebBrowserEvents2_NewWindow3EventHandler(web1_NewWindow3);
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;And the handler:&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;divre id="codeSnippet" style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;/divre&gt;&lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; web1_NewWindow3(&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;ref&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;object&lt;/span&gt; ppDisp, &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;ref&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;bool&lt;/span&gt; Cancel, &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;uint&lt;/span&gt; dwFlags, &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; bstrUrlContext, &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;string&lt;/span&gt; bstrUrl )&lt;br /&gt;{&lt;br /&gt;Process.Start(bstrUrl);&lt;br /&gt;Cancel = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;&lt;br /&gt;}
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Applications don&amp;rsquo;t handle cases where no browser is installed on the system. We have seen applications that don&amp;rsquo;t handle this failure case when executing a URL.
&lt;p&gt;These tend to occur when users don&amp;rsquo;t have a default browser on their systems and then try to click a &amp;ldquo;go online for more information&amp;rdquo; link. We think this is going to be an extremely narrow case &amp;ndash; even so, applications should handle these failures gracefully. &lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; How do I identify the user&amp;rsquo;s default browser?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Use the &lt;a href="http://msdn.microsoft.com/en-us/library/bb776336(VS.85).aspx"&gt;IApplicationAssociationRegistration::QueryCurrentDefault&lt;/a&gt; API to determine the registered browser by checking &lt;strong&gt;&lt;em&gt;QueryCurrentDefault(&amp;ldquo;http&amp;rdquo;, AT_URLPROTOCOL,&amp;nbsp; AL_EFFECTIVE, out progID)&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; My app needs to open the browser. What are the best practices?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Run shellexecute() without hard-coding the name of the browser. Respect the user&amp;rsquo;s choice of default browser and gracefully handle cases where no browser is installed on the system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; How can I check if I&amp;rsquo;m running in one of the E edition for Windows 7?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/ms724358(VS.85).aspx"&gt;GetProductInfo()&lt;/a&gt; API (introduced in Windows Vista) is how to tell exactly what edition of Windows you are running. The new constant values for the E editions of Windows 7 will be available in the Windows 7 SDK.&lt;/p&gt;
&lt;p&gt;Example of code to determine if you are running on Home Premium vs. Ultimate:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;divre id="codeSnippet" style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;/divre&gt;[DllImport(&lt;span style="color: #006080;"&gt;"Kernel32.dll"&lt;/span&gt;)]&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;internal&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;extern&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;bool&lt;/span&gt; GetProductInfo(&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; osMajorVersion,&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; osMinorVersion,&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; spMajorVersion,&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; spMinorVersion,&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;out&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;uint&lt;/span&gt; edition);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; CheckEdition()&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;uint&lt;/span&gt; edition;&lt;br /&gt;GetProductInfo(6, 1, 0, 0, &lt;span style="color: #0000ff;"&gt;out&lt;/span&gt; edition);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;switch&lt;/span&gt; ((ProductEditions)(edition))&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;case&lt;/span&gt; ProductEditions.HOMEPREMIUM :&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;case&lt;/span&gt; ProductEditions.HOMEPREMIUME:&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;case&lt;/span&gt; ProductEditions.HOMEPREMIUMN:&lt;br /&gt;&lt;br /&gt;MessageBox.Show(&lt;span style="color: #006080;"&gt;"Running on a Home Premium edition"&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;case&lt;/span&gt; ProductEditions.ULTIMATE :&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;case&lt;/span&gt; ProductEditions.ULTIMATEE:&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;case&lt;/span&gt; ProductEditions.ULTIMATEN:&lt;br /&gt;MessageBox.Show(&lt;span style="color: #006080;"&gt;"Running on an Ultimate edition"&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;break&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}
&lt;pre&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; Are the E editions of Windows 7 going to be available on MSDN? If so, when?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Yes, both the E editions of Windows 7 and the standard editions will be available on MSDN at the same time. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; What about the Internet Explorer 8 Feature Pack for Windows 7 E? If and when will Microsoft release it to the public?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Yes, the Internet Explorer 8 Feature Pack for Windows 7 E will be available on the Microsoft Download Center soon after Windows 7 becomes generally available.&lt;/p&gt;
&lt;p&gt;Giorgio Sardo&lt;/p&gt;
&lt;p&gt;IE Technical Evangelist &amp;ndash; Microsoft Corp&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=518425" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+Application+Compatibility/default.aspx">Windows 7 Application Compatibility</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/IE+8/default.aspx">IE 8</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Internet+Explorer+8/default.aspx">Internet Explorer 8</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7+E/default.aspx">Windows 7 E</category></item><item><title>Developing for the Windows 7 Taskbar – Jump into Jump Lists – Part 3</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/07/02/developing-for-the-windows-7-taskbar-jump-into-jump-lists-part-3.aspx</link><pubDate>Thu, 02 Jul 2009 20:59:29 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:518119</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=518119</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/07/02/developing-for-the-windows-7-taskbar-jump-into-jump-lists-part-3.aspx#comments</comments><description>&lt;p&gt;So far, you have seen how you can opt into the Windows 7 Taskbar Jump List experience by creating a Jump List for your application (in the &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/06/25/developing-for-the-windows-7-taskbar-jump-into-jump-lists-part-2.aspx"&gt;Developing for the Windows 7 Taskbar – Jump into Jump Lists – Part 2&lt;/a&gt; post.) You have also seen the Windows 7 default support for listing “Recent” or “Frequent” destinations as well as how to create your own custom categories. In this post, we will explore more of the Jump List features and discover how easy it is to add Tasks to your application's Jump List. &lt;/p&gt;  &lt;p&gt;User tasks are customized tasks that get their own Tasks category. As a developer, you can set the title of the displayed task, the icon on the left and, more important, and the “application” that is launched once you activate this task. You can view user’s tasks as shortcuts to the functionality our applications can provide. As you might remember, user tasks are the verbs in our vocabulary; for example, Windows Media Player provides a “Resume last playlist” task and Sticky Notes provides a “New note” task.&lt;/p&gt;  &lt;p&gt;A user task is usually an &lt;a href="http://msdn.microsoft.com/en-us/library/bb774950(VS.85).aspx"&gt;IShellLink&lt;/a&gt; object that launches any given application (your application or any other one you choose) with specific command line parameters. While you cannot categorize tasks, you can separate them using a special separator object. Here’s an example of a Jump List that uses a separator to split three tasks into a group of two plus an additional task:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_17EEBBC0.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_574C6F50.png" width="238" height="230" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So what does it take to add tasks to a Jump List? Well, not that much. Basically it is a single call to the &lt;b&gt;AddUserTasks&lt;/b&gt; function in an interface that we are already familiar with, the ICustomDestinationList (ICustomDestinationList::AddUserTasks(IObjectArray) Method). Looking at the code, you will see a single line of code, &lt;b&gt;hr = pcdl-&amp;gt;AddUserTasks(poa);.&lt;/b&gt;&lt;b&gt; &lt;/b&gt;However, as always, someone needs to create and build that poa, IObjectArray, and parameter and fill it with relevant information. Let’s review that process now.&lt;/p&gt;  &lt;p&gt;We are going to create a collection of IShellLinks. This collection will be later cast to the required IObjectArray parameter. The following code is the beginning of that process.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;IObjectCollection *poc;&lt;br /&gt;HRESULT hr = CoCreateInstance(&lt;br /&gt;D_EnumerableObjectCollection, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&amp;amp;poc));&lt;br /&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;{&lt;br /&gt;    IShellLink * psl;&lt;br /&gt;    hr = _CreateShellLink(L&lt;span style="color: #006080"&gt;&amp;quot;/Task1&amp;quot;&lt;/span&gt;, L&lt;span style="color: #006080"&gt;&amp;quot;Task 1&amp;quot;&lt;/span&gt;, &amp;amp;psl);&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;    {&lt;br /&gt;        hr = poc-&amp;gt;AddObject(psl);&lt;br /&gt;        psl-&amp;gt;Release();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Here you can see that we used COM (again) and CoCreate and IObjectCollection, &lt;b&gt;poc&lt;/b&gt;. Next, we call to a helper function called CreateShellLink that receives three parameters: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The first parameter is the command line argument to the task &lt;/li&gt;

  &lt;li&gt;The second parameter is the title that will be displayed &lt;/li&gt;

  &lt;li&gt;The last parameter is a pointer to IShellLink &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The object is then filed according to the relevant information. &lt;/p&gt;

&lt;p&gt;Last, we add the recently created IShellLink to the object collection. You may ask yourself where the parameter that provides the path to the executable that we plan to launch is. Well that is a good question. For simplicity, we have hard-coded that information as shown in the following code snippet:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;{&lt;br /&gt;    hr = _CreateShellLink2(&lt;br /&gt;            L&lt;span style="color: #006080"&gt;&amp;quot;C:\\Users\\&amp;lt;my user&amp;gt;\\Documents\\new text file.txt&amp;quot;&lt;/span&gt;, &lt;br /&gt;            L&lt;span style="color: #006080"&gt;&amp;quot;NotePad&amp;quot;&lt;/span&gt;, &lt;br /&gt;            &amp;amp;psl);&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;    {&lt;br /&gt;        hr = poc-&amp;gt;AddObject(psl);&lt;br /&gt;        psl-&amp;gt;Release();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Here you can see we call to a hard-coded _&lt;b&gt;CreateShellLink2&lt;/b&gt; function. This receives a path to a text file as one of its parameters and, as you can see, we are launching Notepad. &lt;/p&gt;

&lt;p&gt;Here is the code for the &lt;b&gt;CreateShellLink2&lt;/b&gt; function:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;HRESULT _CreateShellLink2(&lt;br /&gt;            PCWSTR pszArguments, PCWSTR pszTitle, &lt;br /&gt;            IShellLink **ppsl)&lt;br /&gt;{&lt;br /&gt;    IShellLink *psl;&lt;br /&gt;    HRESULT hr = CoCreateInstance(&lt;br /&gt;                    CLSID_ShellLink, &lt;br /&gt;                    NULL, &lt;br /&gt;                    CLSCTX_INPROC_SERVER, &lt;br /&gt;                    IID_PPV_ARGS(&amp;amp;psl));&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;    {&lt;br /&gt;        hr = psl-&amp;gt;SetPath(c_szNotePadExecPath);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;            {&lt;br /&gt;                hr = psl-&amp;gt;SetArguments(pszArguments);&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;                {&lt;br /&gt;                    &lt;span style="color: #008000"&gt;// The title property is required on Jump List items &lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #008000"&gt;// provided as an IShellLink instance. This value is used &lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #008000"&gt;// as the display name in the Jump List.&lt;/span&gt;&lt;br /&gt;                    IPropertyStore *pps;&lt;br /&gt;                    hr = psl-&amp;gt;QueryInterface(IID_PPV_ARGS(&amp;amp;pps));&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;                    {&lt;br /&gt;                        PROPVARIANT propvar;&lt;br /&gt;                        hr = InitPropVariantFromString(pszTitle, &amp;amp;propvar);&lt;br /&gt;                        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;                        {&lt;br /&gt;                            hr = pps-&amp;gt;SetValue(PKEY_Title, propvar);&lt;br /&gt;                            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;                            {&lt;br /&gt;                                hr = pps-&amp;gt;Commit();&lt;br /&gt;                                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;                                {&lt;br /&gt;                                    hr = psl-&amp;gt;QueryInterface&lt;br /&gt;                                            (IID_PPV_ARGS(ppsl));&lt;br /&gt;                                }&lt;br /&gt;                            }&lt;br /&gt;                            PropVariantClear(&amp;amp;propvar);&lt;br /&gt;                        }&lt;br /&gt;                        pps-&amp;gt;Release();&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            hr = HRESULT_FROM_WIN32(GetLastError());&lt;br /&gt;        }&lt;br /&gt;        psl-&amp;gt;Release();&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; hr;&lt;br /&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To start with, again we need to use COM and CoCreate to create an IShellLink COM object. A quick look at the SDK reveals that the IShellLink object has many functions. Here are few that we will use:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;GetPath&lt;/b&gt; Gets the path and file name of a Shell link object, that is the path to the executable &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;GetShowCmd&lt;/b&gt; Gets the show command for a Shell link object, the executable name &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;SetArguments&lt;/b&gt; Sets the command-line arguments for a Shell link object &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;SetDescription&lt;/b&gt; Sets the description for a Shell link object; the description can be any application-defined string &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;SetIconLocation&lt;/b&gt; Sets the location (path and index) of the icon for a Shell link object &lt;b&gt;SetPath&lt;/b&gt; Sets the path and file name of a Shell link object &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;SetWorkingDirectory&lt;/b&gt; Sets the name of the working directory for a Shell link object &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, for each parameter we must get and set appropriate methods. There are additional parameters; take a look at the SDK - &lt;a href="http://msdn.microsoft.com/en-us/library/bb774950(VS.85).aspx"&gt;IShellLink&lt;/a&gt; if you want to learn more.&lt;/p&gt;

&lt;p&gt;In the above example, we set the path to Notepad (by default in the Windows 7 installation, c:\windows\notepad.exe). We also passed a hard-coded (not a good practice) command line argument pointing to a text file in my private document folder (C:\Users\&amp;lt;my user&amp;gt;\Documents\new text file.txt.) The rest of the code sets the title property that is required on Jump List items.&lt;/p&gt;

&lt;p&gt;We call the &lt;b&gt;CreateShellLink2&lt;/b&gt; and &lt;b&gt;CreateShellLink&lt;/b&gt; a few more times to add all three shortcuts as shown in the above screen capture. &lt;/p&gt;

&lt;p&gt;Now let’s add a separator.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;To add a separator to our Task List, we need to create an IShellLink, and set the PKEY_AppUserModel_IsDestListSeparator property using the COM property variant as shown in the following code snippet:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #008000"&gt;// The Tasks category of Jump Lists supports separator items. &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// These are simply IShellLink instances that have the &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;//  PKEY_AppUserModel_IsDestListSeparator property set to TRUE. &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// All other values are ignored when this property is set.&lt;/span&gt;&lt;br /&gt;HRESULT _CreateSeparatorLink(IShellLink **ppsl)&lt;br /&gt;{&lt;br /&gt;    IPropertyStore *pps;&lt;br /&gt;    HRESULT hr = CoCreateInstance(&lt;br /&gt;                    CLSID_ShellLink, &lt;br /&gt;                    NULL, &lt;br /&gt;                    CLSCTX_INPROC_SERVER, &lt;br /&gt;                    IID_PPV_ARGS(&amp;amp;pps));&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;    {&lt;br /&gt;        PROPVARIANT propvar;&lt;br /&gt;        hr = InitPropVariantFromBoolean(&lt;span style="color: #0000ff"&gt;TRUE&lt;/span&gt;, &amp;amp;propvar);&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;        {&lt;br /&gt;            hr = pps-&amp;gt;SetValue(PKEY_AppUserModel_IsDestListSeparator, propvar);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;            {&lt;br /&gt;                hr = pps-&amp;gt;Commit();&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (SUCCEEDED(hr))&lt;br /&gt;                {&lt;br /&gt;                    hr = pps-&amp;gt;QueryInterface(IID_PPV_ARGS(ppsl));&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            PropVariantClear(&amp;amp;propvar);&lt;br /&gt;        }&lt;br /&gt;        pps-&amp;gt;Release();&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; hr;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Here you can see that we used &lt;strong&gt;CoCreate&lt;/strong&gt; to create an &lt;strong&gt;IShellLink&lt;/strong&gt; object. Next, we set a PROPVARIANT, &lt;b&gt;propvar&lt;/b&gt;, to true and set the &lt;strong&gt;IShellLink&lt;/strong&gt; object &lt;strong&gt;PKEY_AppUserModel_IsDestListSepar&lt;/strong&gt;ator property to true. This will instruct the OS to render this &lt;strong&gt;IShellLink&lt;/strong&gt; as a separator and not just as regular &lt;strong&gt;IShellLink&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;OK, that was long. Now let’s look at the short version, using .NET. For that we are going to use the &lt;a href="http://windowsteamblog.com/blogs/developers/archive/2009/05/18/windows-7-managed-code-apis.aspx"&gt;Windows API Code pack for the .NET Framework&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;As we can expect from .NET, we get abstraction from most of the “COM code behind” that is required. The &lt;strong&gt;Microsoft.WindowsAPICodePack.Shell.Taskbar&lt;/strong&gt; namespace includes a &lt;b&gt;JumpListLink&lt;/b&gt; object that extends the &lt;b&gt;ShellLink&lt;/b&gt; object and implements &lt;b&gt;IJumpListTasks&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;b&gt;JumpList&lt;/b&gt; class contains the &lt;b&gt;UserTasks&lt;/b&gt; collection of &lt;b&gt;IJumpListTasks&lt;/b&gt; to which you can simple add new &lt;b&gt;JumpListLink&lt;/b&gt; objects as shown in the following code snippet:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #008000"&gt;// Path to Windows system folder&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; systemFolder = &lt;br /&gt;        Environment.GetFolderPath(Environment.SpecialFolder.System);&lt;br /&gt;&lt;br /&gt;jumpList.UserTasks.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JumpListLink&lt;br /&gt;{&lt;br /&gt;    Title = &lt;span style="color: #006080"&gt;&amp;quot;Open Notepad&amp;quot;&lt;/span&gt;,&lt;br /&gt;    Path = Path.Combine(systemFolder, &lt;span style="color: #006080"&gt;&amp;quot;notepad.exe&amp;quot;&lt;/span&gt;),&lt;br /&gt;    IconReference = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IconReference(&lt;br /&gt;(systemFolder, &lt;span style="color: #006080"&gt;&amp;quot;notepad.exe&amp;quot;&lt;/span&gt;), 0)&lt;br /&gt;});&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Using the C# 3.0 syntax, we initialize a new &lt;b&gt;JumpListLink&lt;/b&gt; object and add it to the &lt;b&gt;UserTasks&lt;/b&gt; collection. As you can see, the managed code &lt;b&gt;JumpListLink&lt;/b&gt; has very similar properties to the native one (which makes perfect sense). We also added an icon to the Notepad shortcut to the above code, but didn't provide any command line parameters. &lt;/p&gt;

&lt;p&gt;You want to add a separator? Well, that is also very easy: just add a &lt;b&gt;JumpListSeperator&lt;/b&gt; object to the UserTasks collection.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;jumpList.UserTasks.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JumpListSeparator());&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;Please note that, as always, when working with the Windows Code pack API Taskbar, you have to call the “refresh” function in order to commit the changes, as we explained in the previous post. &lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;Taskbar.JumpList.RefreshTaskbarList();&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;After the refresh, the Jump List looks as follows:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_7284C851.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_thumb_5F00_5607D671.png" width="239" height="233" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;I’ve compiled a version of a native example from the Windows 7 SDK. You can get a copy of that code from &lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers.CodeSamples/CustomJumpList.zip"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can &lt;a href="http://code.msdn.microsoft.com/WindowsAPICodePack"&gt;download the Windows API Code Pack&lt;/a&gt; that includes the manage code example we used in this post. &lt;/p&gt;

&lt;p&gt;This concludes our Jump List discussion. Our next Taskbar topic is Icon Overlay.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=518119" width="1" height="1"&gt;</description><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Developers/default.aspx">Developers</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Taskbar/default.aspx">Taskbar</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Sample+Code/default.aspx">Sample Code</category></item></channel></rss>