<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Kenny Kerr</title><link>http://weblogs.asp.net/kennykerr/default.aspx</link><description>&lt;span style="color:#4a67b1"&gt;&lt;strong&gt;&lt;em&gt;Produce the highest quality screenshots with the least amount of effort! Use &lt;a href="http://www.windowclippings.com/"&gt;&lt;span style="color:#4a67b1"&gt;Window Clippings&lt;/span&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/KennyKerr" type="application/rss+xml" /><item><title>Asynchronous Agents</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/pu67lkF2TrU/asynchronous-agents.aspx</link><pubDate>Wed, 03 Jun 2009 10:55:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7107005</guid><dc:creator>KennyKerr</dc:creator><slash:comments>0</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/06/03/asynchronous-agents.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;&lt;A href="http://www.parallelroads.com/blog/" mce_href="http://www.parallelroads.com/blog/"&gt;Rick Molloy&lt;/A&gt;, one of the masterminds behind the new concurrency runtime (concrt) and parallel patterns library (PPL), has written an article in the latest issue of MSDN Magazine demonstrating the new asynchronous agents library with the classic dining philosophers problem. &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;A href="http://msdn.microsoft.com/en-gb/magazine/dd882512.aspx" mce_href="http://msdn.microsoft.com/en-gb/magazine/dd882512.aspx"&gt;Concurrent Affairs: Solving The Dining Philosophers Problem With Asynchronous Agents&lt;/A&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Enabling C++ developers to write highly concurrent applications is a major focus of Visual Studio 2010. The beta release includes the Concurrency Runtime, parallel libraries, and development tools aimed at addressing several common problems preventing developers from unlocking the performance potential inherent to multicore hardware. Notably, this includes ensuring that developers can identify and take advantage of opportunities for concurrency in their code, productively manage shared state and its side effects, and not having to worry about building low-overhead concurrency infrastructure that is scalable at run time on a variety of hardware.&lt;/P&gt;
&lt;P mce_keep="true"&gt;In this article, I'm going to demonstrate how to use the new Asynchronous Agents Library included as part of Visual C++ 2010 to manage the difficulties that can arise with shared state. To show you how this works, I will walk through an implementation of a classic concurrency problem: Djikstra's Dining Philosophers. You'll see how the actor-based programming construct of an agent in combination with asynchronous message-passing APIs can be used to provide a correct and easy to understand solution to this problem that doesn't rely directly on threading or synchronization primitives.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Enjoy!&lt;BR&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7107005" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/06/03/asynchronous-agents.aspx</feedburner:origLink></item><item><title>Lost Carrier Pigeon</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/2S9cG7S5xEw/lost-carrier-pigeon.aspx</link><pubDate>Tue, 02 Jun 2009 15:08:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7106121</guid><dc:creator>KennyKerr</dc:creator><slash:comments>3</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/06/02/lost-carrier-pigeon.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;What do you when a carrier pigeon lands in your back yard seemingly lost? &lt;/P&gt;
&lt;P mce_keep="true"&gt;It has bracelets around its feet with numbers but no email address.&amp;nbsp;&amp;nbsp; :)&lt;/P&gt;
&lt;P mce_keep="true"&gt;It’s pretty tame and let me pick it up to inspect its markings.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7106121" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/06/02/lost-carrier-pigeon.aspx</feedburner:origLink></item><item><title>Windows with C++: Introducing Direct2D</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/GNo0hIMw2tM/windows-with-c-introducing-direct2d.aspx</link><pubDate>Tue, 02 Jun 2009 10:44:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7105857</guid><dc:creator>KennyKerr</dc:creator><slash:comments>3</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/06/02/windows-with-c-introducing-direct2d.aspx#comments</comments><description>&lt;p mce_keep="true"&gt;&lt;img src="http://weblogs.asp.net/blogs/kennykerr/MsdnJune2009.gif" mce_src="http://weblogs.asp.net/blogs/kennykerr/MsdnJune2009.gif" align="right" border="0"&gt;I’ve been away from my computer for a few days working on a house renovation project and didn’t notice that my latest Windows with C++ column came out until the mail man delivered a copy of the June 2009 issue of MSDN Magazine.&lt;/p&gt;
&lt;p mce_keep="true"&gt;In this issue I introduce a new technology that I’m very excited about. I’ve been waiting for Direct2D for some time. When Microsoft started pushing WPF as the “one true path” (TM) I just couldn’t persuade myself to buy the sales pitch. If you felt the same way then read on. This just might make your day.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p mce_keep="true"&gt;&lt;a href="http://msdn.microsoft.com/en-gb/magazine/dd861344.aspx" mce_href="http://msdn.microsoft.com/en-gb/magazine/dd861344.aspx"&gt;&lt;b&gt;&lt;i&gt;Windows with C++: Introducing Direct2D&lt;/i&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p mce_keep="true"&gt;With the introduction of Windows Vista a few years ago, it was clear that the era of the Windows Graphics Device Interface (GDI) was coming to an end. GDI, even with the help of GDI+, had been showing its age especially when compared to the superior graphics capabilities of Windows Presentation Foundation (WPF). As if that weren't enough, GDI lost its hardware acceleration while WPF took advantage of Direct3D's abundance of hardware acceleration. &lt;/p&gt;
&lt;p mce_keep="true"&gt;However, if you want to develop high-performance and high-quality commercial applications, you'll still look to C++ and native code to deliver that power. That's why few things excite me more about Windows 7 than the introduction of Direct2D and DirectWrite. Direct2D is a brand new 2D graphics API designed to support the most demanding and visually rich desktop applications with the best possible performance. DirectWrite is also a brand-new API that complements Direct2D and provides hardware-accelerated text, when used with Direct2D, and high-quality text layout and rendering with advanced support for OpenType typography and ClearType text rendering.&lt;/p&gt;
&lt;p mce_keep="true"&gt;In this article, I will explore these new technologies and give you an idea of why it matters and how you can start using them today.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p mce_keep="true"&gt;Big thanks to Mark Lawrence and Ben Constable, from the Direct2D team, for their feedback on the article as well as for providing a side bar discussing rendering performance.&lt;/p&gt;
&lt;p mce_keep="true"&gt;Stay tuned for more Direct2D articles in my upcoming Windows with C++ columns.&lt;/p&gt;
&lt;p&gt;If you’re looking for one of my previous articles &lt;a href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx" mce_href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx"&gt;&lt;font color="#006666"&gt;here is a complete list&lt;/font&gt;&lt;/a&gt; of them for you to browse through. &lt;/p&gt;
&lt;p&gt;Produce the highest quality screenshots with the least amount of effort! Use &lt;a href="http://www.windowclippings.com/" mce_href="http://www.windowclippings.com/"&gt;&lt;font color="#006666"&gt;Window Clippings&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7105857" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/06/02/windows-with-c-introducing-direct2d.aspx</feedburner:origLink></item><item><title>WTL 8.1 is coming!</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/qaoPwKXiRO4/wtl-8-1-is-coming.aspx</link><pubDate>Tue, 19 May 2009 10:01:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7092674</guid><dc:creator>KennyKerr</dc:creator><slash:comments>0</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/05/19/wtl-8-1-is-coming.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;After almost two years of silence there appears to be activity around &lt;A href="http://wtl.sourceforge.net/" mce_href="http://wtl.sourceforge.net/"&gt;WTL&lt;/A&gt; again. Of course this makes sense since Windows 7 is almost done. I just noticed build 8.1.9127 posted over on SourceForge.NET. &lt;/P&gt;
&lt;P mce_keep="true"&gt;For starters it now builds cleanly by internally suppressing warnings against the use of unsafe CRT functions. I have got into the habit of including WTL 8.0 in my precompiled header as follows:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT face="courier new,courier"&gt;#pragma warning(push)&lt;BR&gt;#pragma warning(disable:4996) // WTL still uses some unsafe CRT functions&lt;BR&gt;#include &amp;lt;atlapp.h&amp;gt;&lt;BR&gt;.&lt;BR&gt;.&lt;BR&gt;.&lt;BR&gt;#pragma warning(pop)&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Well no more. To be precise, it still uses those unsafe functions but the warnings are now suppressed internally and explicitly around those functions so that we don’t have to deal with it ourselves.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Wrappers have also been added for the Desktop Window Manager API as well as the support needed to subclass and double-buffer the painting of controls on glass. For more information on the DWM API as well as the issues with controls on glass you can read my articles &lt;A href="http://weblogs.asp.net/kennykerr/archive/2006/08/10/Windows-Vista-for-Developers-_1320_-Part-3-_1320_-The-Desktop-Window-Manager.aspx" mce_href="http://weblogs.asp.net/kennykerr/archive/2006/08/10/Windows-Vista-for-Developers-_1320_-Part-3-_1320_-The-Desktop-Window-Manager.aspx"&gt;here&lt;/A&gt; and &lt;A href="http://weblogs.asp.net/kennykerr/archive/2007/01/23/controls-and-the-desktop-window-manager.aspx" mce_href="http://weblogs.asp.net/kennykerr/archive/2007/01/23/controls-and-the-desktop-window-manager.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Beyond that it looks like this is just the initial placeholder for what will become the 8.1 release of WTL.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7092674" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/05/19/wtl-8-1-is-coming.aspx</feedburner:origLink></item><item><title>Visual Studio 2010 and .NET Framework 4 Beta 1 are here!</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/9DCIBm9OEO8/visual-studio-2010-and-net-framework-4-beta-1-are-here.aspx</link><pubDate>Mon, 18 May 2009 19:40:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7092236</guid><dc:creator>KennyKerr</dc:creator><slash:comments>0</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/05/18/visual-studio-2010-and-net-framework-4-beta-1-are-here.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;Microsoft has finally released an update to the Visual Studio 2010 preview build that showed so much promise but unfortunately was so unreliable. If you have an MSDN subscription just head over to subscriber downloads and start downloading now!&lt;/P&gt;
&lt;P mce_keep="true"&gt;Interestingly (and thankfully) they appear to have reduced the number of SKUs. There is only “Professional” and “Team Suite”. &lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7092236" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/05/18/visual-studio-2010-and-net-framework-4-beta-1-are-here.aspx</feedburner:origLink></item><item><title>Resolving Windows Sleep Problems</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/Q2GQdvEvx8s/resolving-windows-sleep-problems.aspx</link><pubDate>Fri, 08 May 2009 16:58:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7078686</guid><dc:creator>KennyKerr</dc:creator><slash:comments>5</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/05/08/resolving-windows-sleep-problems.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;This is more of a reminder to myself but it may come in handy for you. &lt;/P&gt;
&lt;P mce_keep="true"&gt;Whenever I reinstall Windows I always make sure to install the latest chipset drivers from Intel which tends to make things run more smoothly, especially on laptops, with regards to power management. &lt;/P&gt;
&lt;P mce_keep="true"&gt;On my desktop computer there is one more step I need to take before it will correctly sleep and &lt;EM&gt;stay&lt;/EM&gt; asleep but I always seem to forget this and spend some time wondering which driver or device isn’t letting the computer go to sleep. Nine times out of ten though it’s not as a result faulty or missing drivers but is actually “by design”. &lt;/P&gt;
&lt;P mce_keep="true"&gt;Wired network adapters seem to always be configured to &lt;A href="http://en.wikipedia.org/wiki/Wake-on-LAN" mce_href="http://en.wikipedia.org/wiki/Wake-on-LAN"&gt;Wake-on-LAN&lt;/A&gt; by default. This may be useful for corporate networks but is terribly annoying for home computers where it gives the appearance that Windows simply can’t sleep reliably when in fact it is the network adapter that keeps waking up the computer when network traffic is received.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Anyway the solution is simple, simply uncheck the “Allow this device to wake the computer” option for you wired network adapter:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG border=0 src="http://weblogs.asp.net/blogs/kennykerr/NetworkSleep.png"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hope that helps.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7078686" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/05/08/resolving-windows-sleep-problems.aspx</feedburner:origLink></item><item><title>C++ Exception Handling</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/pBIINlL927Q/c-exception-handling.aspx</link><pubDate>Tue, 05 May 2009 13:19:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7073839</guid><dc:creator>KennyKerr</dc:creator><slash:comments>15</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/05/05/c-exception-handling.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;A while ago I made a passing remark on my blog that I prefer not to use exceptions in native code. Some readers asked me to justify this position and I’ve been a bit reluctant to do so only because it’s a lengthy argument that I’m sure will bring a lot of passionate responses that I don’t really have the time to deal with. I was reminded of this again last night when I walked past one of our bookshelves at home and picked up my copy of &lt;A href="http://www.wintellect.com/CS/blogs/jrobbins/default.aspx" mce_href="http://www.wintellect.com/CS/blogs/jrobbins/default.aspx"&gt;John Robbins&lt;/A&gt;’ excellent &lt;A href="http://www.amazon.com/Debugging-Applications-Microsoft%C2%AE-Microsoft-Pro-Developer/dp/0735615365" mce_href="http://www.amazon.com/Debugging-Applications-Microsoft%C2%AE-Microsoft-Pro-Developer/dp/0735615365"&gt;debugging book&lt;/A&gt; and noticed that it has a chapter on crash handlers within which John does a good job of covering many of the reasons why I don’t use exception handling in native code. If you’re interested in this topic I would encourage you to read John’s book.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Of course I still write “exception safe” code in the sense that I use “resource acquisition is initialization” or constructors and destructors to scope resources, avoid side effects in functions, define invariants, etc. but this is just good practice to write simple and correct code whether or not exceptions are in play.&lt;/P&gt;
&lt;P mce_keep="true"&gt;The Visual C++ compiler actually lets you disable exception handling in your code which by the way improves performance and reduces code size. Here’s how:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;IMG border=0 src="http://weblogs.asp.net/blogs/kennykerr/NoExceptions.png"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;The story is very different for managed code where exceptions are very much an integral part of the runtime and thus cannot be avoided. Of course managed exceptions more than make up for the pitfalls with exception handling by providing a standard base class with exception information including the call stack at the time an exception was thrown thus greatly improving the ability for developers to track down bugs. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7073839" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/05/05/c-exception-handling.aspx</feedburner:origLink></item><item><title>Exciting Changes</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/jtIUez4Rnkg/exciting-changes.aspx</link><pubDate>Tue, 05 May 2009 10:54:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7073624</guid><dc:creator>KennyKerr</dc:creator><slash:comments>3</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/05/05/exciting-changes.aspx#comments</comments><description>&lt;p&gt;I’ve made a few changes to my professional life. I’ve had the opportunity to work with some really talented developers in London and I’m sorry to say goodbye to them. I’ll talk more about that in the coming weeks and months but one of the outcomes is that I’ll have much more time for my software projects. To unwind from employment (e.g. slavery :) ) I took Karin and the kids camping and boy did things change in the world of Microsoft technology in just one week. Here are just some of the announcements.&lt;/p&gt;
&lt;p&gt;Windows 7 (and Server) Release Candidate – by far the biggest news is the arrival of the Windows 7 RC. You can get it from your MSDN subscription along with the latest Windows SDK. The server version of Windows 7, called Windows Server 2008 R2, is also available. Interestingly, the Windows SDK is now split across platforms. &lt;/p&gt;
&lt;p&gt;Office 2007 Service Pack 2 – the next service pack for Office 2007 is out so if there was ever any doubt that Office 2007 is ready for mass corporate adoption you’re now all out of excuses!&amp;nbsp; :)&lt;/p&gt;
&lt;p&gt;Windows Vista Service Pack 2 – the second service pack for Windows Vista has also been released. &lt;/p&gt;
&lt;p&gt;Virtual PC Beta – we all thought it was dead but here comes a new version. It looks like this will be the last version of Virtual PC before Hyper-V is rolled into all versions of Windows. In other words I expect Windows 8 to include Hyper-V just as Windows Server now does. This is in much the same was as Remote Desktop Services first debuted in Windows Server and is now included in all editions of Windows.&lt;/p&gt;
&lt;p&gt;If you really need XP support then you may want to take a look at Windows 7’s XP Mode, which allows you to run Windows XP applications on your Windows 7 desktop. This uses the new version of Virtual PC but will eventually be based on Hyper-V.&lt;/p&gt;
&lt;p&gt;As a (native) C++ developer there’s just so much to be excited about when you consider Windows 7. I’ve started covering Windows 7 technology in my &lt;a href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx" mce_href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx"&gt;Windows with C++&lt;/a&gt; column in MSDN Magazine and you can expect many more articles focused on Windows 7 in the coming months. Here are just a few that I’m particularly interested in:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/magazine/dd569754.aspx" mce_href="http://msdn.microsoft.com/magazine/dd569754.aspx"&gt;Virtual Disk API&lt;/a&gt; – I covered this in the April 2009 issue of MSDN Magazine.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/magazine/dd861344.aspx" mce_href="http://msdn.microsoft.com/magazine/dd861344.aspx"&gt;Direct2D&lt;/a&gt; – I have an introduction to Direct2D in the upcoming June 2009 issue of MSDN Magazine.&lt;/p&gt;
&lt;p&gt;In addition there are new APIs for advanced text rendering and typography, powerful user interface animation, ribbon user interface, web services clients and servers, and much more. And all of this is designed for C++ developers! I’ll be covering many of these in upcoming articles.&lt;/p&gt;
&lt;p&gt;As I’ve said before, these are exciting times for a C++ developer on Windows.&lt;/p&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7073624" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/05/05/exciting-changes.aspx</feedburner:origLink></item><item><title>Another year in the MVP Award program!</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/knA7XibZMAc/mvp2009.aspx</link><pubDate>Thu, 02 Apr 2009 07:16:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7022436</guid><dc:creator>KennyKerr</dc:creator><slash:comments>3</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/04/02/mvp2009.aspx#comments</comments><description>&lt;p&gt;Thanks to all the talented people at Microsoft.&lt;/p&gt;
&lt;p&gt;There's never been a more exciting time to be a C++ developer on the Windows platform!&lt;/p&gt;
&lt;p mce_keep="true"&gt;&lt;img src="http://weblogs.asp.net/blogs/kennykerr/MvpLogo.jpg" mce_src="http://weblogs.asp.net/blogs/kennykerr/MvpLogo.jpg" border="0"&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7022436" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/04/02/mvp2009.aspx</feedburner:origLink></item><item><title>Windows with C++: The Virtual Disk API in Windows 7</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/-4YaVZVH3gQ/windows-with-c-the-virtual-disk-api-in-windows-7.aspx</link><pubDate>Mon, 23 Mar 2009 09:34:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6994598</guid><dc:creator>KennyKerr</dc:creator><slash:comments>0</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/03/23/windows-with-c-the-virtual-disk-api-in-windows-7.aspx#comments</comments><description>&lt;P&gt;&lt;IMG border=0 align=right src="http://weblogs.asp.net/blogs/kennykerr/MsdnMagApril2009b.gif"&gt;My latest Windows with C++ column in the April 2009 issue of MSDN Magazine is now online:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&lt;A href="http://msdn.microsoft.com/magazine/dd569754.aspx" mce_href="http://msdn.microsoft.com/magazine/dd569754.aspx"&gt;&lt;STRONG&gt;&lt;EM&gt;The Virtual Disk API in Windows 7&lt;/EM&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;EM&gt;As I write this, the Windows 7 beta has been available for a few days, and I must say there is a lot to like. As usual, I took a look under the hood to see what is new in the Windows SDK. Windows 7 is very much a minor release as far as the SDK is concerned, and that's a good thing. The fundamentals of writing native C++ applications for Windows 7 have not changed much compared to the way they changed for Windows Vista. Having said that, however, Windows 7 has some completely new features that are sure to interest anyone looking to take advantage of the platform.&lt;/EM&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;EM&gt;One of these features is the Virtual Disk API. Although designed with other formats in mind, the Virtual Disk API in the Windows 7 beta is very much geared toward the Microsoft Virtual Hard Disk (VHD) format popularized by virtualization products from Microsoft such as Hyper-V and Virtual PC.&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Enjoy!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you’re looking for one of my previous articles &lt;A href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx" mce_href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx"&gt;&lt;FONT color=#006666&gt;here is a complete list&lt;/FONT&gt;&lt;/A&gt; of them for you to browse through. &lt;/P&gt;
&lt;P&gt;Produce the highest quality screenshots with the least amount of effort! Use &lt;A href="http://www.windowclippings.com/" mce_href="http://www.windowclippings.com/"&gt;&lt;FONT color=#006666&gt;Window Clippings&lt;/FONT&gt;&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6994598" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/03/23/windows-with-c-the-virtual-disk-api-in-windows-7.aspx</feedburner:origLink></item><item><title>More on COM Safe Arrays and .NET Interop</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/2MvdsyDsnRk/more-on-com-safe-arrays-and-net-interop.aspx</link><pubDate>Thu, 12 Mar 2009 12:37:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6956419</guid><dc:creator>KennyKerr</dc:creator><slash:comments>1</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/03/12/more-on-com-safe-arrays-and-net-interop.aspx#comments</comments><description>
&lt;p&gt;A few years ago &lt;a href="http://weblogs.asp.net/kennykerr/archive/2005/06/20/Is-P_2F00_Invoke-Dead_3F00_.aspx" mce_href="http://weblogs.asp.net/kennykerr/archive/2005/06/20/Is-P_2F00_Invoke-Dead_3F00_.aspx"&gt;I wrote about P/Invoke&lt;/a&gt; and how it can provide benefits even when C++ Interop is available on the consuming end. Recently I’ve had to do a bit of work consuming COM safe arrays from C#. I’ve seen safe arrays trip up developers time and again so I thought I’d share some thoughts and tips on the subject.&lt;br&gt;&lt;br&gt;This discussion focuses on the use of two-dimensional safe arrays. Single-dimensional safe arrays are marshalled automatically by the CLR (in most cases) but it is two-dimensional safe arrays that are often used to communicate key-value pairs such as for a map or dictionary of some kind. The trouble is that a two-dimensional safe array is really just a table of values. You can think of it as having an X axis and a Y axis. Storing key-value pairs in the table then requires a decision to be made regarding whether the keys will be stored down the Y axis as rows or along the X axis as columns. You could argue about which is better but at the end of the day you’re likely going to be at the mercy of whatever native API you’re calling.&lt;br&gt;&lt;br&gt;If keys are stored down the Y axis then a particular key is indexed with the safe array’s first dimension. The first dimension will thus have as many elements as there are pairs. The second dimension will have exactly two elements with the first storing the key and the second storing the value.&lt;br&gt;&lt;br&gt;On the other hand if keys are stored along the X axis then a particular key is indexed not by the first dimension but by the second. The second dimension will thus have as many elements as there are pairs. The first dimension will have exactly two elements with the first storing all the keys and the second storing all the values. &lt;br&gt;&lt;br&gt;Of course not everyone naturally thinks in terms of the same coordinate space and you may need to apply a transform before it makes sense to you. Apologies to graphics developers everywhere.&amp;nbsp; :)&lt;br&gt;&lt;br&gt;Let’s make this a bit more concrete with an example. Here is a native container of string-double pairs implemented by ATL’s &lt;b&gt;CAtlMap &lt;/b&gt;class:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;typedef CAtlMap&amp;lt;CString, double&amp;gt; Map;&lt;br&gt;Map m_map;&lt;/font&gt;&lt;br&gt;&lt;br&gt;The following function creates and returns a safe array keyed along the X axis using ATL’s safe array wrapper classes:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;#define HR(expr) { hr = expr; if (FAILED(hr)) return hr; }&lt;br&gt;&lt;br&gt;HRESULT __stdcall GetDictionaryX(SAFEARRAY** dictionary)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HRESULT hr;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (0 == dictionary)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return E_POINTER;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArrayBound bounds[2] =&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArrayBound(2),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArrayBound(m_map.GetCount())&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArray&amp;lt;VARIANT&amp;gt; safeArray;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HR(safeArray.Create(bounds, _countof(bounds)));&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LONG indices[2] = { 0 };&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; POSITION position = m_map.GetStartPosition();&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (; 0 != position; ++indices[1])&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; const Map::CPair* pair = m_map.GetNext(position);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; indices[0] = 0;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HR(safeArray.MultiDimSetAt(indices, CComVariant(pair-&amp;gt;m_key)));&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; indices[0] = 1;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HR(safeArray.MultiDimSetAt(indices, CComVariant(pair-&amp;gt;m_value)));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *dictionary = safeArray.Detach();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return S_OK;&lt;br&gt;}&lt;/font&gt;&lt;br&gt;&lt;br&gt;Briefly, the bounds define the dimensions of the safe array and the indices are used to set the values in the table.&lt;br&gt;&lt;br&gt;The following function does the same thing but returns a safe array keyed along the Y axis:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;HRESULT __stdcall GetDictionaryY(SAFEARRAY** dictionary)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HRESULT hr;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (0 == dictionary)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return E_POINTER;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArrayBound bounds[2] =&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArrayBound(m_map.GetCount()),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArrayBound(2)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CComSafeArray&amp;lt;VARIANT&amp;gt; safeArray;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HR(safeArray.Create(bounds, _countof(bounds)));&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LONG indices[2] = { 0 };&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; POSITION position = m_map.GetStartPosition();&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (; 0 != position; ++indices[0])&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; const Map::CPair* pair = m_map.GetNext(position);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; indices[1] = 0;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HR(safeArray.MultiDimSetAt(indices, CComVariant(pair-&amp;gt;m_key)));&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; indices[1] = 1;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HR(safeArray.MultiDimSetAt(indices, CComVariant(pair-&amp;gt;m_value)));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *dictionary = safeArray.Detach();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return S_OK;&lt;br&gt;}&lt;br&gt;&lt;/font&gt;&lt;br&gt;With the native code out of the way let’s see how we can call these functions from C#. For simplicity lets assume they’re just exported functions and not COM interface methods. The same principals apply but it’s just less sample code for me to write.&lt;br&gt;&lt;br&gt;The first step is to import the functions as follows:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;[DllImport("Server.dll", EntryPoint = "GetDictionaryY", PreserveSig = false)]&lt;br&gt;[return: MarshalAs(UnmanagedType.SafeArray)]&lt;br&gt;static extern object[,] NativeGetDictionaryY();&lt;br&gt;&lt;br&gt;[DllImport("Server.dll", EntryPoint = "GetDictionaryX", PreserveSig = false)]&lt;br&gt;[return: MarshalAs(UnmanagedType.SafeArray)]&lt;br&gt;static extern object[,] NativeGetDictionaryX();&lt;br&gt;&lt;/font&gt;&lt;br&gt;This just adds some metadata needed by the CLR to call the &lt;b&gt;LoadLibrary &lt;/b&gt;and &lt;b&gt;GetProcAddress &lt;/b&gt;functions on your behalf, how to marshal the parameters and return value, and what to do with the &lt;b&gt;HRESULT&lt;/b&gt;. &lt;br&gt;&lt;br&gt;The next step is to determine how many key-value pairs the two-dimensional array consists of. The array’s &lt;b&gt;GetLength &lt;/b&gt;method comes in handy as you can specify the dimension whose length you are interested in:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;object[,] array = NativeGetDictionaryX();&lt;br&gt;int count = array.GetLength(1);&lt;/font&gt;&lt;br&gt;&lt;br&gt;Given the count you can now enumerate the key-value pairs using a &lt;b&gt;for &lt;/b&gt;loop and a bit of casting:&lt;br&gt;&lt;font face="courier new,courier"&gt;&lt;br&gt;for (int i = 0; i &amp;lt; count; ++i)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string key = (string)array[0, i];&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double value = (double)array[1, i];&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(key + "=" + value);&lt;br&gt;}&lt;br&gt;&lt;/font&gt;&lt;br&gt;Needless to say this is quite error prone. It would be more desirable to use a &lt;b&gt;foreach &lt;/b&gt;loop but the enumerator provided by the multi-dimensional array doesn’t know anything about the key-value pairs so it just returns it in a flat list. The good news is that it’s pretty easy to write your own enumerator or to be precise let the C# compiler generate one for you.&lt;br&gt;&lt;br&gt;Here’s an implementation of the generic &lt;b&gt;IEnumerable&amp;lt;TKey, TValue&amp;gt; &lt;/b&gt;interface that does just what you want for arrays keyed along the X axis:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;class SafeArrayEnumerableX&amp;lt;TKey, TValue&amp;gt; : IEnumerable&amp;lt;KeyValuePair&amp;lt;TKey, TValue&amp;gt;&amp;gt;&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private readonly object[,] m_array;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public SafeArrayEnumerableX(object[,] array)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Assert(null != array);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Assert(2 == array.GetLength(0));&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_array = array;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IEnumerator&amp;lt;KeyValuePair&amp;lt;TKey, TValue&amp;gt;&amp;gt; GetEnumerator()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int count = m_array.GetLength(1);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; count; ++i)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield return new KeyValuePair&amp;lt;TKey, TValue&amp;gt;((TKey)m_array[0, i], (TValue)m_array[1, i]);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return GetEnumerator();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/font&gt;&lt;br&gt;&lt;br&gt;Notice that it’s effectively doing the same looping and casting as the hand-rolled approach but in such a way that you end up with a reusable enumerator that hides all the nasty indexing and casting. With the enumerator providing a sequence of generic &lt;b&gt;KeyValuePair&amp;lt;TKey, TValue&amp;gt; &lt;/b&gt;structures, enumerating over the pairs now becomes much more elegant:&lt;br&gt;&lt;font face="courier new,courier"&gt;&lt;br&gt;static SafeArrayEnumerableX&amp;lt;string, double&amp;gt; GetDictionaryX()&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new SafeArrayEnumerableX&amp;lt;string, double&amp;gt;(NativeGetDictionaryX());&lt;br&gt;}&lt;br&gt;&lt;br&gt;foreach (var pair in GetDictionaryX())&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string key = pair.Key;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double value = pair.Value;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(key + "=" + value);&lt;br&gt;}&lt;/font&gt;&lt;br&gt;&lt;br&gt;And that’s all there is to it. For completeness, here’s the equivalent enumerable implementation for arrays keyed along the Y axis:&lt;br&gt;&lt;br&gt;&lt;font face="courier new,courier"&gt;class SafeArrayEnumerableY&amp;lt;TKey, TValue&amp;gt; : IEnumerable&amp;lt;KeyValuePair&amp;lt;TKey, TValue&amp;gt;&amp;gt;&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private readonly object[,] m_array;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public SafeArrayEnumerableY(object[,] array)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Assert(null != array);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Assert(2 == array.GetLength(1));&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_array = array;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IEnumerator&amp;lt;KeyValuePair&amp;lt;TKey, TValue&amp;gt;&amp;gt; GetEnumerator()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int count = m_array.GetLength(0);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; count; ++i)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield return new KeyValuePair&amp;lt;TKey, TValue&amp;gt;((TKey)m_array[i, 0], (TValue)m_array[i, 1]);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return GetEnumerator();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/font&gt;&lt;br&gt;&lt;br&gt;I hope that helps.&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;If you’re looking for one of my previous articles &lt;a href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx" mce_href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx"&gt;here is a complete list&lt;/a&gt; of them for you to browse 
through. &lt;/p&gt;

&lt;p&gt;Produce the highest quality screenshots with the least amount 
of effort! Use &lt;a href="http://www.windowclippings.com/" mce_href="http://www.windowclippings.com/"&gt;Window 
Clippings&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6956419" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/03/12/more-on-com-safe-arrays-and-net-interop.aspx</feedburner:origLink></item><item><title>Windows with C++: Visual C++ 2010 and the Parallel Patterns Library</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/Eb_eMq7EAsI/windows-with-c-visual-c-2010-and-the-parallel-patterns-library.aspx</link><pubDate>Tue, 27 Jan 2009 09:25:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6861333</guid><dc:creator>KennyKerr</dc:creator><slash:comments>3</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/01/27/windows-with-c-visual-c-2010-and-the-parallel-patterns-library.aspx#comments</comments><description>&lt;P&gt;My latest Windows with C++ column in the February 2009 issue of MSDN Magazine is now online:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/magazine/dd434652.aspx" mce_href="http://msdn.microsoft.com/magazine/dd434652.aspx"&gt;&lt;EM&gt;&lt;STRONG&gt;Windows with C++: Visual C++ 2010 and the Parallel Patterns Library&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Visual C++ is getting a major upgrade in the 2010 release of Visual Studio. Many of the new language and library features are designed purely to make it easier and more natural to express your desires in code. But as has always been the case with C++, the combination of these features is what makes C++ such a powerful and expressive language. &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;So this month I am going to introduce some of the additions to the C++ language that Visual C++ has added as part of the forthcoming C++0x standard. I'll then look at the Parallel Patterns Library (PPL) that Microsoft has developed over and above the C++0x standard to introduce parallelism to your applications in a manner that naturally complements the standard C++ library.&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This article was a bit hard to write as the pre-release version of Visual Studio 2010 that I had at the time of writing was very unstable. The IDE has a long way to go before it is ready for day to day use. There is however a great deal to look forward to for the native C++ developer and I hope you enjoy this introduction to some of the new language and library features.&lt;/P&gt;
&lt;P mce_keep="true"&gt;If you’re looking for one of my previous articles &lt;A href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx" mce_href="http://weblogs.asp.net/kennykerr/pages/My-Articles.aspx"&gt;&lt;FONT color=#006666&gt;here is a complete list&lt;/FONT&gt;&lt;/A&gt; of them for you to browse through. &lt;/P&gt;
&lt;P mce_keep="true"&gt;Produce the highest quality screenshots with the least amount of effort! Use &lt;A href="http://www.windowclippings.com/" mce_href="http://www.windowclippings.com/"&gt;&lt;FONT color=#006666&gt;Window Clippings&lt;/FONT&gt;&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6861333" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/01/27/windows-with-c-visual-c-2010-and-the-parallel-patterns-library.aspx</feedburner:origLink></item><item><title>Windows 7 beta now on MSDN and Connect</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/Ay0_AZukeZs/windows-7-beta-now-on-msdn-and-connect.aspx</link><pubDate>Thu, 08 Jan 2009 07:49:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6826086</guid><dc:creator>KennyKerr</dc:creator><slash:comments>5</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/01/08/windows-7-beta-now-on-msdn-and-connect.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;You can now download the beta of Windows 7 and Windows Server 2008 R2 from &lt;A class="" href="http://msdn.microsoft.com/subscriptions/" mce_href="http://msdn.microsoft.com/subscriptions/"&gt;MSDN subscriber downloads&lt;/A&gt; and from &lt;A class="" href="http://connect.microsoft.com/" mce_href="http://connect.microsoft.com/"&gt;Microsoft Connect&lt;/A&gt;. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRIKE&gt;Unfortunately the Windows SDK is not yet available. Let’s hope that it’s posted soon.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Update: the SDK is now available from MSDN.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6826086" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/01/08/windows-7-beta-now-on-msdn-and-connect.aspx</feedburner:origLink></item><item><title>Manifest View support for DLLs</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/putULDxdQlc/manifest-view-support-for-dlls.aspx</link><pubDate>Fri, 02 Jan 2009 16:38:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6815007</guid><dc:creator>KennyKerr</dc:creator><slash:comments>2</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2009/01/02/manifest-view-support-for-dlls.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;Since I blogged about my &lt;A class="" href="http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx" mce_href="http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx"&gt;Manifest View&lt;/A&gt; tool I’ve had a few requests to add support for viewing manifests embedded within DLLs. It originally only supported viewing manifests embedded within executables. &lt;/P&gt;
&lt;P mce_keep="true"&gt;Well I finally got around to it and spent the&amp;nbsp;five minutes updating the code, rebuilding and testing. You can download it from the &lt;A class="" href="http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx" mce_href="http://weblogs.asp.net/kennykerr/archive/2007/07/10/manifest-view-1-0.aspx"&gt;original blog for Manifest View 1.0 here&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;IMG src="http://weblogs.asp.net/blogs/kennykerr/ManifestViewDll.png" border=0&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hope that helps. And a Happy New Year to you all.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6815007" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2009/01/02/manifest-view-support-for-dlls.aspx</feedburner:origLink></item><item><title>Was Softwear a Joke?</title><link>http://feedproxy.google.com/~r/KennyKerr/~3/mT-flwGiedE/was-softwear-a-joke.aspx</link><pubDate>Mon, 29 Dec 2008 14:09:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6808682</guid><dc:creator>KennyKerr</dc:creator><slash:comments>1</slash:comments><comments>http://weblogs.asp.net/kennykerr/archive/2008/12/29/was-softwear-a-joke.aspx#comments</comments><description>&lt;P&gt;Earlier this month I heard about &lt;A class="" href="http://www.microsoft.com/windows/softwearbymicrosoft/" mce_href="http://www.microsoft.com/windows/softwearbymicrosoft/"&gt;Microsoft’s Softwear&lt;/A&gt; line of t-shirts. It was supposedly launching on the 15th of December. Launching where? &lt;/P&gt;
&lt;P&gt;I checked out the Microsoft company store and there’s no sign of them. But then I also noticed that MVPs get redirected to a &lt;A class="" href="https://shop.ecompanystore.com/microsoft/MIC_Login2.asp" mce_href="https://shop.ecompanystore.com/microsoft/MIC_Login2.asp"&gt;different login page&lt;/A&gt;. The store also seems to only be offering older products. For example there’s no sign of the &lt;A class="" href="http://www.microsoft.com/hardware/bluetrack" mce_href="http://www.microsoft.com/hardware/bluetrack"&gt;BlueTrack mice&lt;/A&gt;. There appears to be a &lt;A class="" href="https://shop.ecompanystore.com/MSEPPStore/login.aspx" mce_href="https://shop.ecompanystore.com/MSEPPStore/login.aspx"&gt;shiny new store&lt;/A&gt; for employees only, or am I dreaming? &lt;/P&gt;
&lt;P&gt;I’m not complaining but it is the first year I have MVP dollars to spend but nothing worth spending&amp;nbsp;them on.&amp;nbsp; :)&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6808682" width="1" height="1"&gt;</description><feedburner:origLink>http://weblogs.asp.net/kennykerr/archive/2008/12/29/was-softwear-a-joke.aspx</feedburner:origLink></item></channel></rss>
