<?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 : Windows 7</title><link>http://windowsteamblog.com/blogs/developers/archive/tags/Windows+7/default.aspx</link><description>Tags: Windows 7</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>Fishbowl for Facebook Using the Windows 7 Taskbar for Extra Spice</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/11/19/fishbowl-for-facebook-using-the-windows-7-taskbar-for-extra-spice.aspx</link><pubDate>Fri, 20 Nov 2009 01:41:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:529030</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=529030</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/11/19/fishbowl-for-facebook-using-the-windows-7-taskbar-for-extra-spice.aspx#comments</comments><description>&lt;p&gt;During Wednesday&amp;rsquo;s keynote, Brian Goldfarb demoed an amazing&amp;nbsp;Silverlight 4 client for Facebook. Beyond its amazing looks,&amp;nbsp;this Silverlight 4&amp;nbsp;demo&amp;nbsp;provides a full and complete desktop client application for Windows (and Mac). SilverFace is built on top of Silverlight 4 &amp;ndash; also announced during the keynote. If you want a cool Facebook client application to work on from your Windows desktop, you should take a look&amp;nbsp;at the&amp;nbsp;&lt;a href="http://www.fishbowlclient.com/"&gt;&lt;strong&gt;Fishbowl for Facebook Preview&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;. &lt;/strong&gt;Fishbowl is a great WPF application that you can install and enjoy as a user, and at the same time it is a&amp;nbsp;great code sample for developers whom are looking to write&amp;nbsp;WPF applications that use Windows 7 features.&amp;nbsp; If you are interested, you can &lt;a href="http://fishbowl.codeplex.com/"&gt;download the source code for Fishbowl&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In today's world, the client&amp;rsquo;s experience is more important than ever before. Your application doesn&amp;rsquo;t just have to be fun and interesting; it has to be good looking, polished, and functional, providing a &amp;ldquo;natural&amp;rdquo; user experience that just works. As a developer, you need to push the envelope and use any available technical tool that the OS provides or any other available means (if installed on mobile devices) to provide a superior user experience, or users will switch to the next guy. In such a competitive scenario, using the Windows 7 Taskbar to shave a few seconds from day-to-day tasks looks like a very obvious choice.&lt;/p&gt;
&lt;p&gt;Both Silverlight 4 demo and Fishbowl applications each provide a great UX and enhance user productivity. Scott Guthrie also announced the &lt;a href="http://msdn.microsoft.com/en-us/windows/ee388574.aspx"&gt;Facebook SDK&lt;/a&gt; for managed code applications that combines the latest in Web and Client platform innovations with leading Social technologies (services) to help developers plug into Facebook. But, beside the new Facebook SDK and beside the great looks, the Fishbowl application is a great WPF (3.5) example that demonstrates how to write applications that produce amazing experiences on Windows 7.&lt;/p&gt;
&lt;p&gt;As a WPF application, Fishbowl runs on multiple Windows versions, including Windows XP, Windows Vista, and Windows 7, and it integrates with the Windows 7 Taskbar and Multitouch. One of the main ideas behind the Taskbar is to provide users with quick and easy access to their content and help them accomplish tasks and navigate between windows easier and with more confidence. For example, JumpList provides a great tool for surfacing common work items and tasks. If you have a task that you perform once or twice a day, taking two or three clicks to perform the task is not that bad. However, if you have a task that you perform 10, 20, or even 30 more times, using JumpList tasks or items in the recent category list goes a long way. Facebook users often check their wall, write notifications and messages, view friends' pictures, and so on. Therefore, in some scenarios, the Taskbar JumpList tasks, icon notification, thumbnail buttons, and other functionality become major tools in the application. &lt;/p&gt;
&lt;p&gt;Fishbowl uses the taskbar to provide a quick, easy, and seamless integration with Facebook functionality directly from your Taskbar. Let&amp;rsquo;s review some of the user functionality before jumping into code behind. &lt;/p&gt;
&lt;table width="551" cellpadding="2" cellspacing="0" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="265" valign="top"&gt;The Fishbowl taskbar offers a few tasks even before you start your application. You can go to Facebook.com, or you can actually &amp;ldquo;jump&amp;rdquo; directly and see your wall, friend's picture, and more, as the following image shows. &lt;br /&gt;One of the amazing things in Fishbowl for Facebook is that it changes it functionality between the different modes of the application. Being able to use the taskbar differently for&lt;/td&gt;
&lt;td width="284" valign="top"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/TaskbarBeforeStart_5F00_119ECE9E.png"&gt;&lt;img height="229" width="240" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/TaskbarBeforeStart_5F00_thumb_5F00_57AF8BB1.png" alt="TaskbarBeforeStart" border="0" title="TaskbarBeforeStart" 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;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;different scenarios provides an amazing user experience in heavily used application like Fishbowl.&lt;/p&gt;
&lt;p&gt;When Fishbowl runs in normal mode, the Taskbar JumpList reflects items and tasks that you can actually perform in the context of a running application, like viewing the last few notifications and messages that you received without opening the application, as shown by the following image.&lt;/p&gt;
&lt;table width="551" cellpadding="2" cellspacing="0" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="225" valign="top"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/TaskbarAfterStart_5F00_6C052B6F.png"&gt;&lt;img height="265" width="164" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/TaskbarAfterStart_5F00_thumb_5F00_191A183E.png" alt="TaskbarAfterStart" border="0" title="TaskbarAfterStart" 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;/td&gt;
&lt;td width="324" valign="top"&gt;If you hover with the mouse above the Fishbowl control, you see the thumbnail preview provided by Windows 7 taskbar. However, Fishbowl uses the thumbnail button again allowing you to both view a preview of the application and act immediately upon the thumbnail preview as shown in the following image.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If you hover with the mouse above the Fishbowl control, you see the thumbnail preview provided by Windows 7 taskbar. However, Fishbowl uses the thumbnail button again allowing you to both view a preview of the application and act immediately upon the thumbnail preview 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/thumbnailbutton_5F00_1CB8331B.png"&gt;&lt;img height="445" width="472" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/thumbnailbutton_5F00_thumb_5F00_1E58D922.png" alt="thumbnail button" border="0" title="thumbnail button" 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;(And thank you Raman for writing so many PDC tweets J)&lt;/p&gt;
&lt;p&gt;Fishbowl also has a mini-mode operation mode. This mode shows just one message in a small window. As you can see in the following image, a small arrow allows you to switch between messages. When you hover over Fishbowl taskbar icon, you can see the preview but you can also control the message, again using the taskbar thumbnail preview.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/minimode_5F00_7A7001C7.png"&gt;&lt;img height="447" width="545" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/minimode_5F00_thumb_5F00_36D850A5.png" alt="minimode" border="0" title="minimode" 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;Besides great Taskbar integration, Fishbowl offers a great Multitouch experience, allowing you to scroll between messages using your finger to touch the touch screen. It is a little hard to illustrate Multitouch with screen capture so you will have to trust me on this one. &lt;/p&gt;
&lt;p&gt;We've covered most of the Fishbowl features unique to Windows 7, and in the next post I will dive into the API that enabled these Taskbar and Multitouch features. If you are interested, you can &lt;a href="http://fishbowl.codeplex.com/"&gt;download the source code for Fishbowl&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=529030" 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/.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/PDC09/default.aspx">PDC09</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/PDC2009/default.aspx">PDC2009</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Windows+API+Code+Pack/default.aspx">Windows API Code Pack</category></item><item><title>Programming Windows 7 Using Visual Studio 2010</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/11/17/programming-windows-7-using-visual-studio-2010.aspx</link><pubDate>Wed, 18 Nov 2009 01:55:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:528861</guid><dc:creator>Yochay Kiriaty</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://windowsteamblog.com/blogs/developers/rsscomments.aspx?PostID=528861</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/11/17/programming-windows-7-using-visual-studio-2010.aspx#comments</comments><description>&lt;table border="0" cellspacing="0" cellpadding="2" width="561"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="350"&gt;         &lt;p&gt;A few weeks ago, just two days before Windows 7 become generally available, Visual Studio 2010 hit its own major milestone with the release its second Community Technical Preview of Visual Studio, known as Visual Studio 2010 Beta 2. To me, it is always exciting to see how the different tools and frameworks evolve and add new features.&amp;#160; It seems that with every release the products get bigger and better, offering an even &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="209"&gt;         &lt;br /&gt;          &lt;br /&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/VSLogo_5F00_4635271E.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 20px; display: inline; border-top: 0px; border-right: 0px" title="VSLogo" border="0" alt="VSLogo" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/VSLogo_5F00_thumb_5F00_1E8EAAF4.png" width="220" height="165" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;greater number of programming&amp;#160; languages, and addressing an ever growing number of areas of development such as Web, client, mobile, parallel, consoles, and devices.&lt;/p&gt;  &lt;p&gt;Despite being a “beta” product, it is much easier to work with Visual Studio 2010 than with VS 2008. It is much easier to control your solutions and, even more importantly, much easier to write and document code. The user interface is much improved; it uses the Windows Presentation Foundation (WPF) to reduce clutter and visual complexity, and modernizes the interface by removing outdated 3D bevels. Using WPF enables us to help developers focus on content areas by opening up negative space between windows and drawing attention to the current focus with a dominant accent color and a distinctive background. There are also some cool, small, and simple perks like the ability to control the size of text. You can also drag a single window from the main Visual studio application to a second monitor (just like that) and with that you have multi-monitor support via the VS client application.&lt;/p&gt;  &lt;p&gt;Improvements to the IntelliSense allow it finally to work well for C++ projects. And let’s not forget the new debugger window that supports parallel computing debugging and lets you view your parallel stacks. &lt;/p&gt;  &lt;p&gt;There is even a new language, F# (F stands for Functional programming), and numerous upgrades to C#, like support for dynamic keywords. Dynamic objects' operations are resolved at runtime (check out a &lt;a href="http://www.hanselman.com/blog/C4AndTheDynamicKeywordWhirlwindTourAroundNET4AndVisualStudio2010Beta1.aspx"&gt;good post&lt;/a&gt; about this by Scott Hanselman). There is also support for the next version of the C++ language specification, C++X0, like Lambda Expressions. Speaking of C++, we've built the C++ solutions using MSBuild, which should make everyone happy.&lt;/p&gt;  &lt;p&gt;As always, backward compatibility is super critical, and it is important to mention that Visual Studio 2010 supports multi-targeting. Visual Studio 2010 can target .NET 2.0 through .NET 4.0 on a per-project basis, which means you can work with your older project on the new VS 2010 and enjoy all the goodies mentioned above (and many more).&lt;/p&gt;  &lt;p&gt;But I want to focus this post on using Visual Studio 2010 to program Windows 7. There are quite few technologies and features in Visual Studio 2010 to help you write better applications targeting the specific features of Windows 7. Below are just a few of the Visual Studio 2010 features that we’ll write more about really soon. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;.NET 4 and Windows 7&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Visual Studio 2010 brings a complete new CLR version – version 4. This is not just an incremental upgrade on top of CLR 2 (.NET Framework 2). This enables new language enhancements like the dynamic keyword. And the new WPF brings support in a few other areas like shell and Taskbar integration, and multitouch. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;WPF &amp;amp; Taskbar Integration &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;As you know, you program jump lists using the &lt;b&gt;JumpList&lt;/b&gt; class. This exposes several methods and properties that manipulate the exposed jump lists for the application. It also has an attached property that you can apply to your application class to create, modify, and remove jump list items. If you work with specific files, you can use the JumpList.AddToRecentCategory method to add that file to the recently used file list managed by the shell.&lt;/p&gt;  &lt;p&gt;There are two types of jump lists – &lt;i&gt;tasks&lt;/i&gt; and &lt;i&gt;items&lt;/i&gt;; you work with each using a &lt;b&gt;JumpTask&lt;/b&gt;, or a &lt;b&gt;JumpPath&lt;/b&gt; respectively. You can work with these in XAML, code-behind, or a combination of the two. The following code snippet shows a simple integration of tasks into a jump list.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;JumpList.JumpList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;JumpList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;JumpTask&lt;/span&gt; &lt;span class="attr"&gt;ApplicationPath&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;notepad.exe&amp;quot;&lt;/span&gt; 
                         &lt;span class="attr"&gt;CustomCategory&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;External Tools&amp;quot;&lt;/span&gt; 
                &lt;span class="attr"&gt;Description&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Take Notes&amp;quot;&lt;/span&gt; 
                &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Start Notepad&amp;quot;&lt;/span&gt; 
                &lt;span class="attr"&gt;IconResourcePath&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;notepad.exe&amp;quot;&lt;/span&gt; 
                &lt;span class="attr"&gt;IconResourceIndex&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;JumpTask&lt;/span&gt; &lt;span class="attr"&gt;ApplicationPath&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;calc.exe&amp;quot;&lt;/span&gt;
                         &lt;span class="attr"&gt;CustomCategory&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;External Tools&amp;quot;&lt;/span&gt; 
                         &lt;span class="attr"&gt;Description&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Perform some calculations&amp;quot;&lt;/span&gt; 
                        &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Start Calculator&amp;quot;&lt;/span&gt;
                        &lt;span class="attr"&gt;IconResourcePath&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;calc.exe&amp;quot;&lt;/span&gt; 
                        &lt;span class="attr"&gt;IconResourceIndex&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;JumpList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;JumpList.JumpList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&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;In a similar way, you can use XAML to add Thumbnail Toolbar buttons as shown by the following code snippet.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TaskbarItemInfo.ThumbButtonInfos&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ThumbButtonInfo&lt;/span&gt; &lt;span class="attr"&gt;DismissWhenClicked&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; 
                    &lt;span class="attr"&gt;ImageSource&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;images/booktrip.png&amp;quot;&lt;/span&gt;
                    &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{Binding BookItinerary}&amp;quot;&lt;/span&gt;
                    &lt;span class="attr"&gt;Description&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Book the itinerary now&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;TaskbarItemInfo.ThumbButtonInfos&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&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;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;WPF Common File Dialog Supports Libraries (Finally!)&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;For some strange reason, WPF 3 and 3.5 Common File Dialog (CFD) didn’t support the updated version of the CFD introduced with Windows Vista. The CFD was upgraded in Windows 7 to support libraries and provide a better user experience. It now allows seamless search integration as well as some advanced user functionality. With WPF 4, applications enjoy the power of the “new” CFD directly from WPF, and don’t need to import CFD from the WinForm namespace (which was the only way to show the updated CFD from WPF 3 and WPF 3.5).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;WPF Supports Multitouch&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;WPF 4.0 introduces multitouch support directly into the WPF API– with no need to interop to a native service. These new features are only available on Windows 7 and are automatically deprecated when running under older operating systems, so you don’t have to detect the operating system yourself. WPF 4.0 adds a new manipulation API to the UIElement base class. This new support allows developers to track multiple touches and generate both cumulative and individual manipulations across the touches. Basically, this enables you to transform your object on the X and Y coordinates, rotation, and scale. &lt;/p&gt;

&lt;p&gt;WPF will supply these manipulation events if the &lt;b&gt;IsManipulationEnabled&lt;/b&gt; property on the element is set to true. It defaults to false, so you will need to turn on this property for each element where you want to manage manipulations. This is as simple as adding IsManipulationEnabled=true to your XAML as shown in the following code snippet. &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Border&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;10,5&amp;quot;&lt;/span&gt; 
    &lt;span class="attr"&gt;BorderBrush&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;DarkGoldenrod&amp;quot;&lt;/span&gt; 
    &lt;span class="attr"&gt;BorderThickness&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; 
        &lt;span class="attr"&gt;CornerRadius&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;10&amp;quot;&lt;/span&gt; 
    &lt;span class="attr"&gt;MinHeight&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;75&amp;quot;&lt;/span&gt; 
    &lt;span class="attr"&gt;IsManipulationEnabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Optionally, you can also hook the &lt;b&gt;ManipulationStarting&lt;/b&gt; and &lt;b&gt;ManipulationCompleted&lt;/b&gt; events to provide code behind the implementation of these events. &lt;/p&gt;

&lt;p&gt;WPF 4 also supports low-level touch messages, or raw touch input. You can interact with the raw touch events on any &lt;b&gt;UIElement&lt;/b&gt; using &lt;b&gt;TouchDown&lt;/b&gt;, &lt;b&gt;TouchMove,&lt;/b&gt; and &lt;b&gt;TouchUp&lt;/b&gt; events, all of which have preview event versions. This can be useful if you are trying to track multiple touches that are not manipulating the same object, or if you want to provide different behavior for touches and the mouse. We’ll soon write more about Windows 7 multitouch in general and WPF specifically. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;MFC Updates&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In Visual Studio 2010, C++ and MFC received a healthy dosage of “coolness” factor, adding useful features such as IntelliSense enhancements and C++0x features. The MFC Library received a major upgrade, especially in regard to the Taskbar, Multitouch, and Restart and Recovery:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;i&gt;Taskbar&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The MFC Taskbar provides all the functionality that the native taskbar COM API provides. There is nothing that the one can do that the other cannot. The MFC simply wraps the Win32 APIs (as it always does) into a more “MFC-like” API that corresponds to the MFC Framework programming style guidelines. For example, the following code snippet sets the overlay icon.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;CMainFrame* mainFrm = 
dynamic_cast&amp;lt;CMainFrame*&amp;gt;(AfxGetApp()-&amp;gt;GetMainWnd());
&lt;span class="kwrd"&gt;if&lt;/span&gt; (mainFrm)
    mainFrm-&amp;gt;SetTaskbarOverlayIcon(IDI_ICON_INFO,L&lt;span class="str"&gt;&amp;quot;Info&amp;quot;&lt;/span&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;First you need to obtain a handle (a pointer) to the application's main window (the top-level window), which corresponds to Win32 HWND. Then, simply call the SetTaskbarOverlayIcon passing HICON and a string that provides an alt text version of the information conveyed by the overlay to meet accessibility requirements. Simple, right?&lt;/p&gt;

&lt;p&gt;In MFC, the CFrameWnd class provides the functionality of a Windows single document interface (SDI), overlapped, or pop-up frame window. With the new MFC, this class was updated and now supports Taskbar functionality such as icon overlay, progress bar, jump lists, and thumbnails. &lt;/p&gt;

&lt;p&gt;In MFC, Taskbar thumbnail preview support is built in, so the Taskbar thumbnails will show any rendering within the views. Therefore, other than implementing your own View drawing, you need not provide any explicit code to update those Thumbnails.&lt;/p&gt;

&lt;p&gt;To enable Taskbar Thumbnails in an MFC application while using the MFC application wizard, all the user needs to do is select the “Multiple documents” application type with the option “Tabbed documents” enabled. When the application runs, MFC will take a snapshot of each view and send it to the Taskbar APIs to display as thumbnails.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_5D36703E.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_1508B462.png" width="535" height="422" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;And the output could like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_13C41B83.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_58FC72AC.png" width="339" height="350" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;i&gt;Multitouch&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In Visual Studio 2010, MFC also supports multitouch. By default, on a touch-enabled device (such as touch screen), Windows 7 sends gesture touch messages to any application; that is, by default Windows 7 sends WM_GESTURE messages to the target windows. All that MFC is doing is mapping these messages to its own message handlers. MFC provides a number of message handler overrides that can receive each of the gesture types, and each returns a Boolean value. If a gesture input is processed by the application, the corresponding override should return TRUE; otherwise, it returns FALSE. Therefore if you wish to handle the zoom gestures, all you need to do is implement the relevant handler. Here is the list of supported handlers.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;// Gesture handlers&lt;/span&gt;
&lt;span class="kwrd"&gt;virtual&lt;/span&gt; BOOL OnGestureZoom(CPoint ptCenter, &lt;span class="kwrd"&gt;long&lt;/span&gt; lDelta);
&lt;span class="kwrd"&gt;virtual&lt;/span&gt; BOOL OnGesturePan(CPoint ptFrom, CPoint ptTo);
&lt;span class="kwrd"&gt;virtual&lt;/span&gt; BOOL OnGestureRotate(CPoint ptCenter, &lt;span class="kwrd"&gt;double&lt;/span&gt; dblAngle);
&lt;span class="kwrd"&gt;virtual&lt;/span&gt; BOOL OnGesturePressAndTap(CPoint ptFirstFinger, &lt;span class="kwrd"&gt;long&lt;/span&gt; lDelta);
&lt;span class="kwrd"&gt;virtual&lt;/span&gt; BOOL OnGestureTwoFingerTap(CPoint ptCenter);&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;&amp;#160;&lt;/p&gt;

&lt;p&gt;Similarly, you can register to receive raw touch messages and the default gesture messages. In Windows 7, gestures messages and raw touch are mutually exclusive. If you register to receive the raw touch messages for a particular window, that window will stop receiving gestures messages. If you opt-in to handle raw touch messages, you need to implement the following handler:&lt;/p&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;virtual&lt;/span&gt; BOOL OnTouchInput(
                        CPoint pt, 
                        &lt;span class="kwrd"&gt;int&lt;/span&gt; nInputNumber, 
                        &lt;span class="kwrd"&gt;int&lt;/span&gt; nInputsCount, 
                        PTOUCHINPUT pInput);&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;MFC makes your life easier by providing a lot of the information per each touch point, for example, the client coordinates for the actual point where the touch-enabled device has been touched. MFC also provides the ID of the touch point, that is, the first, second, or third finger, as well as the total count of current touches.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;i&gt;Restart and Recovery &lt;/i&gt;(&lt;i&gt;Restart Manager&lt;/i&gt;)&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In Visual Studio 2010, MFC also provides native support of the Restart Manager. Restart Manager is a feature introduced by the Microsoft Windows Vista operating system. It can help applications maintain their data when an update needs to shutdown the application or when an unexpected software error or crash occurs. Instead of shutting down abnormally, Restart Manager enables an application to perform an application save before it is terminated. Furthermore, it can re-invoke the application, enabling it to restore its state from before the shutdown or crash. &lt;/p&gt;

&lt;p&gt;For new MFC applications, you can get the application restart and recovery feature for free by using the MFC Application Wizard as you can see from the following image:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/clip_5F00_image001_5F00_5DFEB05B.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/clip_5F00_image001_5F00_thumb_5F00_76221AB6.png" width="425" height="243" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All configurable parts of the restart manager API are exposed to the user through virtual members that can be over-ridden. Needless to say, you can expect some more blogging about this feature. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;.NET 4 and Location&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;.NET 4 has a new Device namespace that supports the Windows 7 Location API (part of the Windows 7 Sensor and Location. The &lt;b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.device.location(VS.100).aspx"&gt;System.Device.Location&lt;/a&gt;&lt;/b&gt; namespace allows application developers to access the user's location easily using a single API. Location information may come from multiple providers, such as GPS, Wi-Fi triangulation, and cell phone tower triangulation. The System.Device.Location classes provide a single API to encapsulate the multiple location providers on a computer and support seamless prioritization and transitioning between them. An application developer using this API does not need to know which location-sensing technologies are available on a particular computer and is freed from the burden of tailoring an application to a specific hardware configuration.&lt;/p&gt;

&lt;p&gt;To begin accessing location, you need to create a &lt;b&gt;GeoLocationProvider&lt;/b&gt;. This object is the main “location manager” object through which you can register for &lt;b&gt;LocationChange&lt;/b&gt; notifications and synchronously read the latest location information. Next you need to call &lt;b&gt;Start&lt;/b&gt; to start the acquisition of data from the current location provider. You can check the &lt;b&gt;Status&lt;/b&gt; property to determine if data is available. If data is available, you can get the location once from the &lt;b&gt;Location&lt;/b&gt; property, or receive continuous location updates using the &lt;b&gt;LocationChanged&lt;/b&gt; event. The following code snippet is a VERY simple code sample showing how to retrieve the current GeoCoordinates (latitude, longitude). &lt;/p&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;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;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;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;GeoLocationProvider provider = &lt;span class="kwrd"&gt;new&lt;/span&gt; GeoLocationProvider();
provider.Start();
GeoCoordinate coordinate = provider.Location.Coordinate;
&lt;span class="kwrd"&gt;if&lt;/span&gt; (coordinate != GeoCoordinate.Unknown)
{
  &lt;span class="rem"&gt;//Business logic here&lt;/span&gt;
}&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately, .NET 4 supports only the Location API and not the full Sensor and Location Platform – meaning that the .NET location implementation is still missing the Sensor piece. Use the Windows API Code Pack to access sensor from managed code.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Parallel Computing and Windows 7 Multi-Core &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Parallel programming in Visual Studio 2010 has many aspects, for example, Parallel LINQ and other .NET enhancements for supporting parallel computing, including statements like Parallel.For that use System.Threading.Tasks.Task. C++ developers will be happy to learn that the Task concepts also exist in C++ Version 10, which ships with VS 2010. For native code, Concurrency Runtime (ConcRT) has &lt;b&gt;implicit knowledge&lt;/b&gt; of &lt;a href="http://blogs.msdn.com/nativeconcurrency/archive/2009/02/04/concurrency-runtime-and-windows-7.aspx"&gt;&lt;b&gt;Win7 processor groups&lt;/b&gt;&lt;/a&gt; and will schedule work on up to 256 cores; ConcRT also takes advantage of User Mode Scheduling of threads. Therefore, any workload that sits on top of ConcRT immediately benefits. In other words, because both the Parellel Pattern Library (PPL) and Asynchronous Agents are included in Visual C++ 10 CRT and are built on top of ConcRT, any workloads you build on them will scale to 256 cores--&lt;/p&gt;

&lt;p&gt;just like that! (Well, you will still need to write the code, but the scaling is free.)&lt;/p&gt;

&lt;p&gt;For managed code applications, the story is less bright. Management of the managed stack thread sits on top of the .NET ThreadPool (System.Threading.ThreadPool) by default. This does not use the new processor group APIs in Windows 7, and therefore doesn’t automatically benefit from the Windows 7 ability to scale. The maximum number of processes that the threadpool can utilize is 64. But not everything is lost, it is possible to write a custom TaskScheduler that targeted more than 64 procs, and use the rest of the Task Parallel Library with &lt;b&gt;that special scheduler. This would be a cool CodePlex project, right?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Overall Visual Studio 2010 includes tons of new technologies and improvements--all of it icing on the Windows 7 cake! &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=528861" 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/.NET/default.aspx">.NET</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Reporting Live from the Windows 7 Seminar: Boot Camp</title><link>http://windowsteamblog.com/blogs/developers/archive/2009/11/16/reporting-live-from-the-windows-7-seminar-boot-camp.aspx</link><pubDate>Mon, 16 Nov 2009 20:07:11 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:528734</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=528734</wfw:commentRss><comments>http://windowsteamblog.com/blogs/developers/archive/2009/11/16/reporting-live-from-the-windows-7-seminar-boot-camp.aspx#comments</comments><description>&lt;table border="0" cellspacing="0" cellpadding="2" width="502"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="351"&gt;Here we are at the LA Convention Center, attending the &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;. We managed to “&lt;b&gt;sell out&lt;/b&gt;” (just a reminder-- it is free) this event, getting more than 1200 registrations. This day is all about learning what’s new in the Windows 7 kernel, how developers can take advantage of these feature, and then learn how to take advantage of some “user mode” features like multitouch, taskbar, sensor and location, and others. &lt;/td&gt;        &lt;td valign="top" width="149"&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_3CE0E669.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_2378E32F.png" width="136" height="186" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Today started with &lt;a href="http://channel9.msdn.com/shows/Going%20Deep/Mark-Russinovich-Inside-Windows-7/"&gt;Mark Russinovich&lt;/a&gt;, Technical Fellow and the man behind &lt;a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx"&gt;SysInternals&lt;/a&gt; and many of the improvements in Windows 7, describing some of the changes made to the Windows 7 kernel. Immediately after Mark, &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Arun-Kishan-Process-Management-in-Windows-Vista/"&gt;Arun Kishan&lt;/a&gt;, a Principal Architect for the process management components, described his work around the thread and process allocation that frees the kernel from its thread dispatcher locks and gives Windows 7 the ability to scale seamlessly to 256 cores. Then &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Landy-Wang-Windows-Memory-Manager/"&gt;Landy Wang&lt;/a&gt;, a Distinguished Engineer in the Kernel team, described changes made in Windows 7 memory management, mainly focusing on memory Working Set and memory trimming.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/developers/image_5F00_0A10DFF5.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_58C1F594.png" width="551" height="424" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After lunch, Jaime started his run, giving some insight and very useful tips about using the Taskbar, from understanding the difference between Application ID and Program ID to the effective use of custom previews. Jaime has only 60 minutes, but I am sure his tips for working with the Taskbar will prove very useful. For example:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Tip1 – when writing your own jump list item or link, make sure you remember what items you wrote, because you can’t just “read” the jump list items&lt;/li&gt;    &lt;li&gt;Tip2 – if you decide to invest in cutom switcher and provide your own thumbnail preview and Aero Peak make sure you “save the state” of your application and images as DWM will not always perform for you.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I'll be up next, explaining Windows 7 libraries in depth, with a focus on useful tips for programming Windows 7 libraries, and specifically how to stay in sync with library updates. We have already had plenty of Windows 7 libraries posts - &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;, so I am not going into great detail. However, I do want to hand out the presentations and code samples used. &lt;strong&gt;All &lt;/strong&gt;my demos as well as Jaime’s are part of the &lt;a href="http://channel9.msdn.com/learn/courses/Windows7/"&gt;Windows 7 Training kit&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Right after our discussion about libraries, we will take a deep dive into the Windows 7 Sensor and Location platform. I just LOVE the endless amount of innovation and opportunity developers have generated while using this platform. After the Windows 7 launch on October 22&lt;sup&gt;nd&lt;/sup&gt;, we saw a large number of laptop models coming out with built-in sensors. Developers will most probably use these to create truly adaptive applications that adjust their functionality and UI based on sensor input.&amp;#160; &lt;/p&gt;  &lt;p&gt;After our Sensor and Location Platform discussion, it will be Michael Oneppo's turn to explain the changes in the Windows 7 graphics stack. Michael's presentation is very interesting, as it describes some of the DirectX API that was down ported to Windows 7 as a result of the &lt;a href="http://support.microsoft.com/kb/971644"&gt;Platform Update for Windows Vista and the Platform Update for Windows Server 2008&lt;/a&gt;. For example, did you know that the Microsoft Direct3D API DirectCompute feature allows your applications to use a new pipeline stage in the GPU, the &lt;b&gt;compute shader&lt;/b&gt; stage, to implement highly data-parallel algorithms with unmatched speed and performance? This means that now you can use GPU power for parallel programming, freeing your CPU to do other things. It is amazing how powerful these GPUs have become; allowing them remain idle would be a huge waste of resources. If you want to learn more, you can always view Chas Boyd PDC session – &lt;a href="http://microsoftpdc.com/Sessions/P09-16"&gt;DirectX11 DirectCompute&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;To close the learning part of the day, &lt;a href="http://blogs.msdn.com/jaimer/"&gt;Jaime Rodriguez&lt;/a&gt; takes us through a quick tour of Windows 7 multitouch. Jaime is taking his usual practical teaching approach of focusing on a few tips and tricks that will make it easier for you to start using multitouch. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://windowsteamblog.com/aggbug.aspx?PostID=528734" 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/Windows/default.aspx">Windows</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/PDC09/default.aspx">PDC09</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/PDC2009/default.aspx">PDC2009</category><category domain="http://windowsteamblog.com/blogs/developers/archive/tags/Performance/default.aspx">Performance</category></item><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 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>30</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>15</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>17</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>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></channel></rss>