<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Neil Cowburn - OpenNETCF</title>
    <link>http://blog.opennetcf.com/ncowburn/</link>
    <description>Principal Partner of OpenNETCF Consulting &amp; Co-Founder of OpenNETCF.org</description>
    <language>en-us</language>
    <copyright>Neil Cowburn</copyright>
    <lastBuildDate>Mon, 20 Apr 2009 15:30:52 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>neilc@opennetcf.com</managingEditor>
    <webMaster>neilc@opennetcf.com</webMaster>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nd/3.0/</creativeCommons:license><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/neilco" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=bd9637fa-2423-4720-9565-b0ea6f3f89b4</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,bd9637fa-2423-4720-9565-b0ea6f3f89b4.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,bd9637fa-2423-4720-9565-b0ea6f3f89b4.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=bd9637fa-2423-4720-9565-b0ea6f3f89b4</wfw:commentRss>
      <title>HOWTO: Determine whether or not a library exports a function</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,bd9637fa-2423-4720-9565-b0ea6f3f89b4.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/ehM_qhtpz4Y/HOWTODetermineWhetherOrNotALibraryExportsAFunction.aspx</link>
      <pubDate>Mon, 20 Apr 2009 15:30:52 GMT</pubDate>
      <description>&lt;p&gt;
Back in May 2008, I wrote a blog post about &lt;a href="http://blog.opennetcf.com/ncowburn/2008/05/17/SDFFuturesCheckingForWin32Methods.aspx"&gt;checking
for Win32 methods&lt;/a&gt;. I was recently reminded of this when a customer emailed us
about a scenario that exactly matched the intended use case.
&lt;/p&gt;
&lt;p&gt;
The customer was using the &lt;a href="http://www.smartdeviceframework.com/"&gt;Smart Device
Framework&lt;/a&gt; with a Windows CE 5.0 device and was receiving a MissingMethodException
"&lt;i&gt;Can't find an Entry Point 'xxx' in a PInvoke DLL 'yyy'&lt;/i&gt;". The exception message
is detailed enough to explain the situation -- since Windows CE is modular, whoever
created the OS image had not added a required component, resulting in the native functions
to be missing from coredll.dll. This is not an uncommon scenario in the Windows CE
world. 
&lt;/p&gt;
&lt;p&gt;
Below is an example of how you can gracefully handle calling the &lt;b&gt;PlaySound&lt;/b&gt; function
from &lt;b&gt;coredll.dll&lt;/b&gt; even on devices that don't support the function. The important
part is the call to &lt;i&gt;Device.Win32Library("coredll").HasMethod("PlaySound")&lt;/i&gt;.
This is return false if coredll.dll does not exist or if coredll.dll does not export
the PlaySound function. Of course, you could raise a &lt;b&gt;PlatformNotSupportedException&lt;/b&gt; or
try another mechanism for playing the sound file instead of just returning without
calling the native PlaySound function. The important point is that you should code
in a way that can handle scenarios where the native function is not available and
adapt accordingly.
&lt;/p&gt;
&lt;pre class="vb" name="code"&gt;Imports System.Runtime.InteropServices
Imports OpenNETCF.Reflection

Partial Public Class MainForm
  Friend Class NativeMethods
    Private Const SND_ASYNC As Integer = &amp;H1
    Private Const SND_FILENAME As Integer = &amp;H20000

    Public Shared Sub SafelyPlaySound(ByVal soundFile As String)
      If Not Device.Win32Library("coredll").HasMethod("PlaySound") Then
        Exit Sub ' Function is not exported so we silently return
      End If

      ' Coredll exists and the PlaySound function has been exported
      ' so we can safely make the P/Invoke call
      PlaySound(soundFile, IntPtr.Zero, SND_ASYNC And SND_FILENAME)
    End Sub

    &amp;lt;DllImport("coredll.dll", EntryPoint:="PlaySound", SetLastError:=True)&amp;gt; _
    Private Shared Function PlaySound(ByVal szSound As String, _
                                      ByVal hMod As IntPtr, _
                                      ByVal flags As Integer) As Integer
    End Function

  End Class
End Class

&lt;/pre&gt;&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=bd9637fa-2423-4720-9565-b0ea6f3f89b4" /&gt;&lt;img src="http://feeds.feedburner.com/~r/neilco/~4/ehM_qhtpz4Y" height="1" width="1"/&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,bd9637fa-2423-4720-9565-b0ea6f3f89b4.aspx</comments>
      <category>.NET Compact Framework</category>
      <category>HOWTO</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2009/04/20/HOWTODetermineWhetherOrNotALibraryExportsAFunction.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=e0e3a482-c72a-4a85-9769-a63a3815c45a</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,e0e3a482-c72a-4a85-9769-a63a3815c45a.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,e0e3a482-c72a-4a85-9769-a63a3815c45a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=e0e3a482-c72a-4a85-9769-a63a3815c45a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last week we quietly launched a fantastic new promotion for our <a href="http://www.opennetcf.com/padarn.ocf">Padarn
Web Server</a> product:
</p>
        <p style="text-align: center; margin: 0 auto;">
          <a href="http://www.opennetcf.com/padarn.ocf">
            <img src="http://opennetcf.com/Portals/0/freepadarn.png" border="0" />
          </a>
        </p>
        <p>
Padarn is a lightweight, single-purpose web server that supports a growing subset
of ASP.NET. It is written entirely in C# and can be used as stand-alone web server,
or embedded into an existing application. Padarn can be used to create elegant, data-driven
web sites using SQL Server Compact Edition, or interface with a whole myriad of hardware
peripherals, such as web cams, sensors, controllers, etc. 
</p>
        <p>
If you would like more information on Padarn, please send an email to <a href="mailto:padarn@opennetcf.com?Subject=Padarn%20Promo">padarn@opennetcf.com</a>.
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=e0e3a482-c72a-4a85-9769-a63a3815c45a" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/gEA9vwWHuD4" height="1" width="1" /></body>
      <title>Get Padarn for free!</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,e0e3a482-c72a-4a85-9769-a63a3815c45a.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/gEA9vwWHuD4/GetPadarnForFree.aspx</link>
      <pubDate>Mon, 20 Apr 2009 12:42:42 GMT</pubDate>
      <description>&lt;p&gt;
Last week we quietly launched a fantastic new promotion for our &lt;a href="http://www.opennetcf.com/padarn.ocf"&gt;Padarn
Web Server&lt;/a&gt; product:
&lt;/p&gt;
&lt;p style="text-align: center; margin: 0 auto;"&gt;
&lt;a href="http://www.opennetcf.com/padarn.ocf"&gt;&lt;img src="http://opennetcf.com/Portals/0/freepadarn.png" border="0" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Padarn is a lightweight, single-purpose web server that supports a growing subset
of ASP.NET. It is written entirely in C# and can be used as stand-alone web server,
or embedded into an existing application. Padarn can be used to create elegant, data-driven
web sites using SQL Server Compact Edition, or interface with a whole myriad of hardware
peripherals, such as web cams, sensors, controllers, etc. 
&lt;/p&gt;
&lt;p&gt;
If you would like more information on Padarn, please send an email to &lt;a href="mailto:padarn@opennetcf.com?Subject=Padarn%20Promo"&gt;padarn@opennetcf.com&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=e0e3a482-c72a-4a85-9769-a63a3815c45a" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,e0e3a482-c72a-4a85-9769-a63a3815c45a.aspx</comments>
      <category>.NET Compact Framework</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2009/04/20/GetPadarnForFree.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=9a403b2a-9977-49c4-9671-d8f9b6111863</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,9a403b2a-9977-49c4-9671-d8f9b6111863.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,9a403b2a-9977-49c4-9671-d8f9b6111863.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=9a403b2a-9977-49c4-9671-d8f9b6111863</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <div style="border: 3px solid #c2c2c2; padding: 10px; background-color: #e6e6e6">
          <b>Note:</b> This blog post only applies to Smart Device Framework Standard or Professional
Edition customers. 
</div>
        <p>
If you open the SDF Public Source solution that ships with Smart Device Framework
2.3 and then build the source, you'll come across the following error:
</p>
        <pre>Friend access was granted to 'OpenNETCF,PublicKey=...', but the output assembly is 
named 'OpenNETCF, Version=2.3.0.21, Culture=neutral, PublicKeyToken=null'. Try 
adding a reference to 'OpenNETCF,PublicKey=...' or changing the output assembly name 
to match.</pre>
        <p>
(Note that I've replaced the actual public key with ellipses in the above. You will
see an extraordinarily long hexadecimal number in your errors list in Visual Studio.) 
</p>
        <p>
The easiest way to remedy this is through a quick search &amp; replace. Hit <b>Ctrl-H</b> to
bring up the <b>Find &amp; Replace</b> window. In the <b>Find what</b> text box, enter
the following: 
</p>
        <pre>,PublicKey=00240000048000009400000006020000002400005253413100040000010001002beeba3
bfe7c548e085cffb8c2b6fd61ddd02b06d70864bb7de8bb22473edf5ab4b2196ff98e232c3e87f11fd
7986b743d5d3fdd6ecaf624bacfed116e1cefa50cd652365371d0ebd2702eb1084fed46df79ac0f59f4
d66c547918613d56dcf106843f3458516d3cd26f057a346d9f645fc24a7410a095c754835916e13cdbe</pre>
        <p>
Make sure the <b>Replace with</b> text box is empty and the <b>Look in</b> combobox
is showing <b>Entire Solution</b>. Click the <b>Replace All</b> button. When the search
&amp; replace has completed, build the solution again and it will succeed. 
</p>
        <p>
If you wish to do this manually (you may only want to use 1 or 2 of the 16 projects),
you will need to modify the <b>AssemblyInfo.cs</b> file for the following projects: 
</p>
        <ul>
          <li>
OpenNETCF</li>
          <li>
OpenNETCF.Configuration</li>
          <li>
OpenNETCF.Net</li>
          <li>
OpenNETCF.Windows.Forms</li>
        </ul>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=9a403b2a-9977-49c4-9671-d8f9b6111863" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/U2ujoSLAHtM" height="1" width="1" /></body>
      <title>HOWTO: Build the Smart Device Framework source code</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,9a403b2a-9977-49c4-9671-d8f9b6111863.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/U2ujoSLAHtM/HOWTOBuildTheSmartDeviceFrameworkSourceCode.aspx</link>
      <pubDate>Fri, 06 Mar 2009 11:19:08 GMT</pubDate>
      <description>&lt;p&gt;
&lt;div style="border: 3px solid #c2c2c2; padding: 10px; background-color: #e6e6e6"&gt;
&lt;b&gt;Note:&lt;/b&gt; This blog post only applies to Smart Device Framework Standard or Professional
Edition customers. 
&lt;/div&gt;
&gt;
&lt;p&gt;
If you open the SDF Public Source solution that ships with Smart Device Framework
2.3 and then build the source, you'll come across the following error:
&lt;/p&gt;
&lt;pre&gt;Friend access was granted to 'OpenNETCF,PublicKey=...', but the output assembly is 
named 'OpenNETCF, Version=2.3.0.21, Culture=neutral, PublicKeyToken=null'. Try 
adding a reference to 'OpenNETCF,PublicKey=...' or changing the output assembly name 
to match.&lt;/pre&gt;
&lt;p&gt;
(Note that I've replaced the actual public key with ellipses in the above. You will
see an extraordinarily long hexadecimal number in your errors list in Visual Studio.) 
&lt;/p&gt;
&lt;p&gt;
The easiest way to remedy this is through a quick search &amp;amp; replace. Hit &lt;b&gt;Ctrl-H&lt;/b&gt; to
bring up the &lt;b&gt;Find &amp;amp; Replace&lt;/b&gt; window. In the &lt;b&gt;Find what&lt;/b&gt; text box, enter
the following: 
&lt;/p&gt;
&lt;pre&gt;,PublicKey=00240000048000009400000006020000002400005253413100040000010001002beeba3
bfe7c548e085cffb8c2b6fd61ddd02b06d70864bb7de8bb22473edf5ab4b2196ff98e232c3e87f11fd
7986b743d5d3fdd6ecaf624bacfed116e1cefa50cd652365371d0ebd2702eb1084fed46df79ac0f59f4
d66c547918613d56dcf106843f3458516d3cd26f057a346d9f645fc24a7410a095c754835916e13cdbe&lt;/pre&gt;
&lt;p&gt;
Make sure the &lt;b&gt;Replace with&lt;/b&gt; text box is empty and the &lt;b&gt;Look in&lt;/b&gt; combobox
is showing &lt;b&gt;Entire Solution&lt;/b&gt;. Click the &lt;b&gt;Replace All&lt;/b&gt; button. When the search
&amp;amp; replace has completed, build the solution again and it will succeed. 
&lt;/p&gt;
&lt;p&gt;
If you wish to do this manually (you may only want to use 1 or 2 of the 16 projects),
you will need to modify the &lt;b&gt;AssemblyInfo.cs&lt;/b&gt; file for the following projects: 
&lt;ul&gt;
&lt;li&gt;
OpenNETCF&lt;/li&gt;
&lt;li&gt;
OpenNETCF.Configuration&lt;/li&gt;
&lt;li&gt;
OpenNETCF.Net&lt;/li&gt;
&lt;li&gt;
OpenNETCF.Windows.Forms&lt;/li&gt;
&lt;/ul&gt;
&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=9a403b2a-9977-49c4-9671-d8f9b6111863" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,9a403b2a-9977-49c4-9671-d8f9b6111863.aspx</comments>
      <category>HOWTO</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2009/03/06/HOWTOBuildTheSmartDeviceFrameworkSourceCode.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=33a49113-3023-47fd-aecf-d1df889befe5</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,33a49113-3023-47fd-aecf-d1df889befe5.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,33a49113-3023-47fd-aecf-d1df889befe5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=33a49113-3023-47fd-aecf-d1df889befe5</wfw:commentRss>
      <slash:comments>9</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today, we released <a href="http://www.smartdeviceframework.com/">Smart Device Framework
2.3</a>. This is the long awaited release of the Smart Device Framework for Visual
Studio 2008. 
</p>
        <p>
It's been a painful path to get to this point, what with contending with <a href="http://blog.opennetcf.com/ctacke/2008/11/26/Studio08sToolboxAndCompactFrameworkAssemblies.aspx">frustrating
bugs in Visual Studio 2008 forms designer</a> and all, but we finally got there. Thanks
for you patience and understanding. 
</p>
        <p>
Along with the new version is a new naming convention. We've dropped the name <i>Smart
Device Framework Extensions for Visual Studio</i> with its Standard and Premium editions.
Instead, say hello to Smart Device Framework <b>Standard Edition</b> and <b>Professional
Edition</b>. Be sure to check out the new <a href="http://www.opennetcf.com/sdf/">feature
matrix</a> to find out how each edition differs.
</p>
        <p>
We've got some pretty cool stuff features in the libraries, notably <b>OpenNETCF.Core</b> which
contains a dozen or so extension methods for common scenarios, as well as <b>OpenNETCF.Net.Mail</b>,
for sending mail via SMTP directly from the device -- this eliminates the need to
configure a mail account on the device.
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=33a49113-3023-47fd-aecf-d1df889befe5" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/DvEoaVB9uEU" height="1" width="1" /></body>
      <title>ANN: Smart Device Framework 2.3</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,33a49113-3023-47fd-aecf-d1df889befe5.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/DvEoaVB9uEU/ANNSmartDeviceFramework23.aspx</link>
      <pubDate>Wed, 26 Nov 2008 17:09:47 GMT</pubDate>
      <description>&lt;p&gt;
Today, we released &lt;a href="http://www.smartdeviceframework.com/"&gt;Smart Device Framework
2.3&lt;/a&gt;. This is the long awaited release of the Smart Device Framework for Visual
Studio 2008. 
&lt;/p&gt;
&lt;p&gt;
It's been a painful path to get to this point, what with contending with &lt;a href="http://blog.opennetcf.com/ctacke/2008/11/26/Studio08sToolboxAndCompactFrameworkAssemblies.aspx"&gt;frustrating
bugs in Visual Studio 2008 forms designer&lt;/a&gt; and all, but we finally got there. Thanks
for you patience and understanding. 
&lt;/p&gt;
&lt;p&gt;
Along with the new version is a new naming convention. We've dropped the name &lt;i&gt;Smart
Device Framework Extensions for Visual Studio&lt;/i&gt; with its Standard and Premium editions.
Instead, say hello to Smart Device Framework &lt;b&gt;Standard Edition&lt;/b&gt; and &lt;b&gt;Professional
Edition&lt;/b&gt;. Be sure to check out the new &lt;a href="http://www.opennetcf.com/sdf/"&gt;feature
matrix&lt;/a&gt; to find out how each edition differs.
&lt;/p&gt;
&lt;p&gt;
We've got some pretty cool stuff features in the libraries, notably &lt;b&gt;OpenNETCF.Core&lt;/b&gt; which
contains a dozen or so extension methods for common scenarios, as well as &lt;b&gt;OpenNETCF.Net.Mail&lt;/b&gt;,
for sending mail via SMTP directly from the device -- this eliminates the need to
configure a mail account on the device.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=33a49113-3023-47fd-aecf-d1df889befe5" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,33a49113-3023-47fd-aecf-d1df889befe5.aspx</comments>
      <category>.NET Compact Framework</category>
      <category>Mobility/Embedded</category>
      <category>OpenNETCF</category>
      <category>VS 2008</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/11/26/ANNSmartDeviceFramework23.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=faa7a649-3004-4a7d-a956-8a121b352ce1</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,faa7a649-3004-4a7d-a956-8a121b352ce1.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,faa7a649-3004-4a7d-a956-8a121b352ce1.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=faa7a649-3004-4a7d-a956-8a121b352ce1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you reference an assembly compiled against .NET Compact Framework 2.0 in a project
targeting .NET Compact Framework, it's quite likely you will receive a number of <b>ResolveAssemblyReferences</b> warnings,
similar to this:
</p>
        <pre>ResolveAssemblyReferences:
  Consider app.config remapping of assembly "System.Windows.Forms, Culture=neutral, 
  PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "2.0.0.0" [] to 
  Version "3.5.0.0" [C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\
  WindowsCE\System.Windows.Forms.dll] to solve conflict and get rid of warning.</pre>
        <p>
This warning occurs when the compiler has loaded the .NET Compact Framework 3.5 base
class libraries (BCLs) and the referenced assembly, but the metadata contained in
the referenced assembly references the .NET Compact Framework 2.0 BCLs. 
</p>
        <p>
To remove the warnings you can add an App.Config to your project and redirect the
assembly bindings from the 2.0 versions to the 3.5 equivalents. Below is an example
of the XML required in the App.Config to redirect the 2.0 version of System.dll to
the 3.5 version.
</p>
        <pre class="xml" name="code">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
  &lt;runtime&gt;
    &lt;assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
      &lt;dependentassembly&gt;
        &lt;assemblyidentity name="System" culture="neutral" publickeytoken="969db8053d3322ac" /&gt;
        &lt;bindingredirect  newVersion="3.5.0.0" oldVersion="2.0.0.0" /&gt;
      &lt;/dependentassembly&gt;
    &lt;/assemblybinding&gt;
  &lt;/runtime&gt;
&lt;/configuration&gt;</pre>
        <p>
You will need to add a <b>dependentassembly</b> element for each of the ResolveAssemblyReferences
warnings that you receive.
</p>
        <p>
Make sure the <b>Build Action</b> property of the App.Config is set to <b>Content</b> and
the <b>Copy To Output Directory</b> property is set to <b>Only if newer</b>. Then,
rebuild your solution and the warnings should not appear. 
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=faa7a649-3004-4a7d-a956-8a121b352ce1" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/w-mvd7RxtyQ" height="1" width="1" /></body>
      <title>HOWTO: Prevent ResolveAssemblyReferences warnings in Visual Studio 2008</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,faa7a649-3004-4a7d-a956-8a121b352ce1.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/w-mvd7RxtyQ/HOWTOPreventResolveAssemblyReferencesWarningsInVisualStudio2008.aspx</link>
      <pubDate>Tue, 12 Aug 2008 15:09:06 GMT</pubDate>
      <description>&lt;p&gt;
When you reference an assembly compiled against .NET Compact Framework 2.0 in a project
targeting .NET Compact Framework, it's quite likely you will receive a number of &lt;b&gt;ResolveAssemblyReferences&lt;/b&gt; warnings,
similar to this:
&lt;/p&gt;
&lt;pre&gt;ResolveAssemblyReferences:
  Consider app.config remapping of assembly "System.Windows.Forms, Culture=neutral, 
  PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "2.0.0.0" [] to 
  Version "3.5.0.0" [C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\
  WindowsCE\System.Windows.Forms.dll] to solve conflict and get rid of warning.&lt;/pre&gt;
&lt;p&gt;
This warning occurs when the compiler has loaded the .NET Compact Framework 3.5 base
class libraries (BCLs) and the referenced assembly, but the metadata contained in
the referenced assembly references the .NET Compact Framework 2.0 BCLs. 
&lt;/p&gt;
&lt;p&gt;
To remove the warnings you can add an App.Config to your project and redirect the
assembly bindings from the 2.0 versions to the 3.5 equivalents. Below is an example
of the XML required in the App.Config to redirect the 2.0 version of System.dll to
the 3.5 version.
&lt;/p&gt;
&lt;pre class="xml" name="code"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&gt;
&amp;lt;configuration&gt;
  &amp;lt;runtime&gt;
    &amp;lt;assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
      &amp;lt;dependentassembly&gt;
        &amp;lt;assemblyidentity name="System" culture="neutral" publickeytoken="969db8053d3322ac" /&gt;
        &amp;lt;bindingredirect  newVersion="3.5.0.0" oldVersion="2.0.0.0" /&gt;
      &amp;lt;/dependentassembly&gt;
    &amp;lt;/assemblybinding&gt;
  &amp;lt;/runtime&gt;
&amp;lt;/configuration&gt;&lt;/pre&gt;
&lt;p&gt;
You will need to add a &lt;b&gt;dependentassembly&lt;/b&gt; element for each of the ResolveAssemblyReferences
warnings that you receive.
&lt;/p&gt;
&lt;p&gt;
Make sure the &lt;b&gt;Build Action&lt;/b&gt; property of the App.Config is set to &lt;b&gt;Content&lt;/b&gt; and
the &lt;b&gt;Copy To Output Directory&lt;/b&gt; property is set to &lt;b&gt;Only if newer&lt;/b&gt;. Then,
rebuild your solution and the warnings should not appear. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=faa7a649-3004-4a7d-a956-8a121b352ce1" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,faa7a649-3004-4a7d-a956-8a121b352ce1.aspx</comments>
      <category>.NET Compact Framework</category>
      <category>HOWTO</category>
      <category>OpenNETCF</category>
      <category>VS 2008</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/08/12/HOWTOPreventResolveAssemblyReferencesWarningsInVisualStudio2008.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=d2422827-824f-443e-b0d0-629d3b9799a9</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,d2422827-824f-443e-b0d0-629d3b9799a9.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,d2422827-824f-443e-b0d0-629d3b9799a9.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=d2422827-824f-443e-b0d0-629d3b9799a9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There's been a lot of internal discussion today on how to leverage C# 3.0 features
without requiring .NET Compact Framework 3.5. Mark has the low down on using extension
methods with a little compiler misdirection hack. 
</p>
        <p>
The discussions kicked off because I discovered that you can use <a href="http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx">lambda
expressions</a> with .NET Compact Framework 2.0 projects in Visual Studio 2008. <a href="http://twitter.com/neilco/statuses/865281558">I
even twittered about it yesterday</a>. <i>(Note: it didn't take me too long to realize <a href="http://twitter.com/neilco/statuses/865310767">it's
not a bug</a>, but due to Visual Studio 2008 using the C# 3.0 compiler.)</i> Code
like the following <i>just works</i> -- no hacks required:
</p>
        <pre name="code" class="csharp">
delegate double PowerOf(double x, double y);

static void Main() 
{
    PowerOf pwr = (x, y) =&gt; Math.Pow(x, y);
    double result = pwr(2, 3);
}</pre>
        <p>
If you are using Visual Studio 2008 and still need to target .NET Compact Framework
2.0, the little things like this go a long way to creating and maintaining reusable
code.
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=d2422827-824f-443e-b0d0-629d3b9799a9" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/kOWWaO_9H0U" height="1" width="1" /></body>
      <title>Lambda expressions in .NET Compact Framework 2.0</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,d2422827-824f-443e-b0d0-629d3b9799a9.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/kOWWaO_9H0U/LambdaExpressionsInNETCompactFramework20.aspx</link>
      <pubDate>Wed, 23 Jul 2008 16:13:23 GMT</pubDate>
      <description>&lt;p&gt;
There's been a lot of internal discussion today on how to leverage C# 3.0 features
without requiring .NET Compact Framework 3.5. Mark has the low down on using extension
methods with a little compiler misdirection hack. 
&lt;/p&gt;
&lt;p&gt;
The discussions kicked off because I discovered that you can use &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx"&gt;lambda
expressions&lt;/a&gt; with .NET Compact Framework 2.0 projects in Visual Studio 2008. &lt;a href="http://twitter.com/neilco/statuses/865281558"&gt;I
even twittered about it yesterday&lt;/a&gt;. &lt;i&gt;(Note: it didn't take me too long to realize &lt;a href="http://twitter.com/neilco/statuses/865310767"&gt;it's
not a bug&lt;/a&gt;, but due to Visual Studio 2008 using the C# 3.0 compiler.)&lt;/i&gt; Code
like the following &lt;i&gt;just works&lt;/i&gt; -- no hacks required:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
delegate double PowerOf(double x, double y);

static void Main() 
{
    PowerOf pwr = (x, y) =&gt; Math.Pow(x, y);
    double result = pwr(2, 3);
}&lt;/pre&gt;
&lt;p&gt;
If you are using Visual Studio 2008 and still need to target .NET Compact Framework
2.0, the little things like this go a long way to creating and maintaining reusable
code.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=d2422827-824f-443e-b0d0-629d3b9799a9" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,d2422827-824f-443e-b0d0-629d3b9799a9.aspx</comments>
      <category>.NET Compact Framework</category>
      <category>OpenNETCF</category>
      <category>Visual Studio</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/07/23/LambdaExpressionsInNETCompactFramework20.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=af019ac1-c8c9-4b02-8b82-1574f3b48479</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,af019ac1-c8c9-4b02-8b82-1574f3b48479.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,af019ac1-c8c9-4b02-8b82-1574f3b48479.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=af019ac1-c8c9-4b02-8b82-1574f3b48479</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p style="text-align: center">
          <img src="http://www.opennetcf.com/Portals/0/MSWEP/Gold_Partner_rgb.png" />
        </p>
        <p>
Over the last few months we've been working hard to attain the Gold Level partner
status in the Microsoft Partner Program and I'm extremely pleased to say that we've
done it! For our customers, this is an assurance that by choosing to work with OpenNETCF
products and our consultants, you really are choosing a high calibre company. 
</p>
        <p>
Massive amounts of credit for <a href="http://blog.opennetcf.com/marteaga">Mark</a> for
driving this internally. Good job!
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=af019ac1-c8c9-4b02-8b82-1574f3b48479" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/PiF5pcRh_uc" height="1" width="1" /></body>
      <title>OpenNETCF is now a Microsoft Gold Partner</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,af019ac1-c8c9-4b02-8b82-1574f3b48479.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/PiF5pcRh_uc/OpenNETCFIsNowAMicrosoftGoldPartner.aspx</link>
      <pubDate>Wed, 16 Jul 2008 10:04:10 GMT</pubDate>
      <description>
&lt;p style="text-align: center"&gt;
&lt;img src="http://www.opennetcf.com/Portals/0/MSWEP/Gold_Partner_rgb.png" /&gt;
&lt;/p&gt;
&lt;p&gt;
Over the last few months we've been working hard to attain the Gold Level partner
status in the Microsoft Partner Program and I'm extremely pleased to say that we've
done it! For our customers, this is an assurance that by choosing to work with OpenNETCF
products and our consultants, you really are choosing a high calibre company. 
&lt;/p&gt;
&lt;p&gt;
Massive amounts of credit for &lt;a href="http://blog.opennetcf.com/marteaga"&gt;Mark&lt;/a&gt; for
driving this internally. Good job!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=af019ac1-c8c9-4b02-8b82-1574f3b48479" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,af019ac1-c8c9-4b02-8b82-1574f3b48479.aspx</comments>
      <category>General</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/07/16/OpenNETCFIsNowAMicrosoftGoldPartner.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=ce65e9c5-4053-482c-bc70-b52b9888c0b4</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,ce65e9c5-4053-482c-bc70-b52b9888c0b4.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,ce65e9c5-4053-482c-bc70-b52b9888c0b4.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=ce65e9c5-4053-482c-bc70-b52b9888c0b4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The next <b>Smart Device Development Chat</b> will take place on MSDN at <b>10am PST</b> on <b>Wednesday,
July 16.</b></p>
        <p>
Please join experts from the Windows Mobile, Windows CE, SQL Server CE and .NET Compact
Framework communities in a chat around application development for smart devices.
These chats are a great opportunity to have your questions answered by experts from
around the world. 
</p>
        <p>
          <a href="http://www.microsoft.com/communities/chats/vcs/08_0716_msdn_SDD.ics">Add
to Calendar</a>
        </p>
        <p>
If you cannot attend the MSDN Chat, there is a permanent chat room available on the <a href="http://chat.neilcowburn.com/" target="_new">web</a> and
via <a href="irc://irc.freenode.net/mobiledev">IRC (irc://irc.freenode.net/mobiledev)</a>.
Engage with your peers online today! 
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=ce65e9c5-4053-482c-bc70-b52b9888c0b4" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/SXc3xK--5OM" height="1" width="1" /></body>
      <title>Mark your calendars - Smart Device Development Chat, July 16.</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,ce65e9c5-4053-482c-bc70-b52b9888c0b4.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/SXc3xK--5OM/MarkYourCalendarsSmartDeviceDevelopmentChatJuly16.aspx</link>
      <pubDate>Fri, 11 Jul 2008 10:05:14 GMT</pubDate>
      <description>&lt;p&gt;
The next &lt;b&gt;Smart Device Development Chat&lt;/b&gt; will take place on MSDN at &lt;b&gt;10am PST&lt;/b&gt; on &lt;b&gt;Wednesday,
July 16.&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Please join experts from the Windows Mobile, Windows CE, SQL Server CE and .NET Compact
Framework communities in a chat around application development for smart devices.
These chats are a great opportunity to have your questions answered by experts from
around the world. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.microsoft.com/communities/chats/vcs/08_0716_msdn_SDD.ics"&gt;Add
to Calendar&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
If you cannot attend the MSDN Chat, there is a permanent chat room available on the &lt;a href="http://chat.neilcowburn.com/" target="_new"&gt;web&lt;/a&gt; and
via &lt;a href="irc://irc.freenode.net/mobiledev"&gt;IRC (irc://irc.freenode.net/mobiledev)&lt;/a&gt;.
Engage with your peers online today! 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=ce65e9c5-4053-482c-bc70-b52b9888c0b4" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,ce65e9c5-4053-482c-bc70-b52b9888c0b4.aspx</comments>
      <category>Mobility/Embedded</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/07/11/MarkYourCalendarsSmartDeviceDevelopmentChatJuly16.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=9a2d5a26-1485-49db-8f67-7931b2088658</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,9a2d5a26-1485-49db-8f67-7931b2088658.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,9a2d5a26-1485-49db-8f67-7931b2088658.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=9a2d5a26-1485-49db-8f67-7931b2088658</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I got an email last week asking about how to disable a particular network connection
under Vista. The specific scenario, how to disable an active 3G connection, is not
something I'm going to cover, but what I present below could be used as basis for
that scenario.
</p>
        <p>
With Vista, Microsoft introduced two new methods to the <a href="msdn.microsoft.com/en-us/library/aa394216(VS.85).aspx">Win32_NetworkAdapter</a> class
under <a href="msdn.microsoft.com/en-us/library/aa394582.aspx">WMI</a>: <b>Enable</b> and <b>Disable</b>.
Before can call either of those methods, we need to know how to enumerate the network
connections.
</p>
        <p>
The .NET Framework SDK provides a helpful utility called <b>mgmtclassgen.exe</b>,
which can be used to create .NET-friendly wrappers of the WMI classes. Open up a Visual
Studio command prompt and enter the following:
</p>
        <pre>mgmtclassgen Win32_NetworkAdapter -p NetworkAdapter.cs</pre>
        <p>
This will generate a file called NetworkAdapter.cs which will contain a C# representation
of the WMI Win32_NetworkAdapter class. You can add this source code file to your C#
project and then access all the properties without too much extra effort.
</p>
        <p>
To filter and disable the specific adapters, you do something like this:
</p>
        <pre name="code" class="csharp">SelectQuery query = new SelectQuery("Win32_NetworkAdapter", "NetConnectionStatus=2");
ManagementObjectSearcher search = new ManagementObjectSearcher(query);
foreach(ManagementObject result in search.Get())
{
    NetworkAdapter adapter = new NetworkAdapter(result);

    // Identify the adapter you wish to disable here. 
    // In particular, check the AdapterType and 
    // Description properties.

    // Here, we're selecting the LAN adapters.
    if (adapter.AdapterType.Equals("Ethernet 802.3")) 
    {
        adapter.Disable();
    }
}</pre>
        <p>
Don't forget to add a reference to <b>System.Management.dll</b>!
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=9a2d5a26-1485-49db-8f67-7931b2088658" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/5T9pElYNVC0" height="1" width="1" /></body>
      <title>HOW-TO: Disable/Enable Network Connections Programmatically under Vista</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,9a2d5a26-1485-49db-8f67-7931b2088658.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/5T9pElYNVC0/HOWTODisableEnableNetworkConnectionsProgrammaticallyUnderVista.aspx</link>
      <pubDate>Tue, 24 Jun 2008 15:06:00 GMT</pubDate>
      <description>&lt;p&gt;
I got an email last week asking about how to disable a particular network connection
under Vista. The specific scenario, how to disable an active 3G connection, is not
something I'm going to cover, but what I present below could be used as basis for
that scenario.
&lt;/p&gt;
&lt;p&gt;
With Vista, Microsoft introduced two new methods to the &lt;a href="msdn.microsoft.com/en-us/library/aa394216(VS.85).aspx"&gt;Win32_NetworkAdapter&lt;/a&gt; class
under &lt;a href="msdn.microsoft.com/en-us/library/aa394582.aspx"&gt;WMI&lt;/a&gt;: &lt;b&gt;Enable&lt;/b&gt; and &lt;b&gt;Disable&lt;/b&gt;.
Before can call either of those methods, we need to know how to enumerate the network
connections.
&lt;/p&gt;
&lt;p&gt;
The .NET Framework SDK provides a helpful utility called &lt;b&gt;mgmtclassgen.exe&lt;/b&gt;,
which can be used to create .NET-friendly wrappers of the WMI classes. Open up a Visual
Studio command prompt and enter the following:
&lt;/p&gt;
&lt;pre&gt;mgmtclassgen Win32_NetworkAdapter -p NetworkAdapter.cs&lt;/pre&gt;
&lt;p&gt;
This will generate a file called NetworkAdapter.cs which will contain a C# representation
of the WMI Win32_NetworkAdapter class. You can add this source code file to your C#
project and then access all the properties without too much extra effort.
&lt;/p&gt;
&lt;p&gt;
To filter and disable the specific adapters, you do something like this:
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;SelectQuery query = new SelectQuery("Win32_NetworkAdapter", "NetConnectionStatus=2");
ManagementObjectSearcher search = new ManagementObjectSearcher(query);
foreach(ManagementObject result in search.Get())
{
    NetworkAdapter adapter = new NetworkAdapter(result);

    // Identify the adapter you wish to disable here. 
    // In particular, check the AdapterType and 
    // Description properties.

    // Here, we're selecting the LAN adapters.
    if (adapter.AdapterType.Equals("Ethernet 802.3")) 
    {
        adapter.Disable();
    }
}&lt;/pre&gt;
&lt;p&gt;
Don't forget to add a reference to &lt;b&gt;System.Management.dll&lt;/b&gt;!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=9a2d5a26-1485-49db-8f67-7931b2088658" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,9a2d5a26-1485-49db-8f67-7931b2088658.aspx</comments>
      <category>.NET Framework</category>
      <category>HOWTO</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/06/24/HOWTODisableEnableNetworkConnectionsProgrammaticallyUnderVista.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=c157733d-c758-4ca7-ab31-8a23d39e3b23</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,c157733d-c758-4ca7-ab31-8a23d39e3b23.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,c157733d-c758-4ca7-ab31-8a23d39e3b23.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=c157733d-c758-4ca7-ab31-8a23d39e3b23</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A little later than I intended, but here is the transcript to Smart Device Development
chat from May 13, 2008: <a href="http://opennetcf.com/chats/2008-05-13.html">Read
it here</a></p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=c157733d-c758-4ca7-ab31-8a23d39e3b23" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/ZfV68H4og-0" height="1" width="1" /></body>
      <title>Chat Transcript: May 13, 2008 - Smart Device Development Chat</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,c157733d-c758-4ca7-ab31-8a23d39e3b23.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/ZfV68H4og-0/ChatTranscriptMay132008SmartDeviceDevelopmentChat.aspx</link>
      <pubDate>Mon, 16 Jun 2008 16:41:58 GMT</pubDate>
      <description>&lt;p&gt;
A little later than I intended, but here is the transcript to Smart Device Development
chat from May 13, 2008: &lt;a href="http://opennetcf.com/chats/2008-05-13.html"&gt;Read
it here&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=c157733d-c758-4ca7-ab31-8a23d39e3b23" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,c157733d-c758-4ca7-ab31-8a23d39e3b23.aspx</comments>
      <category>Mobility/Embedded</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/06/16/ChatTranscriptMay132008SmartDeviceDevelopmentChat.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.opennetcf.com/ncowburn/Trackback.aspx?guid=44952503-2a1e-41d3-a301-3da2cf7fc936</trackback:ping>
      <pingback:server>http://blog.opennetcf.com/ncowburn/pingback.aspx</pingback:server>
      <pingback:target>http://blog.opennetcf.com/ncowburn/PermaLink,guid,44952503-2a1e-41d3-a301-3da2cf7fc936.aspx</pingback:target>
      <dc:creator>Neil Cowburn</dc:creator>
      <wfw:comment>http://blog.opennetcf.com/ncowburn/CommentView,guid,44952503-2a1e-41d3-a301-3da2cf7fc936.aspx</wfw:comment>
      <wfw:commentRss>http://blog.opennetcf.com/ncowburn/SyndicationService.asmx/GetEntryCommentsRss?guid=44952503-2a1e-41d3-a301-3da2cf7fc936</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-047037733X.html">
          <img src="http://blog.opennetcf.com/ncowburn/content/binary/SamBook.jpg" border="0" style="float: left; padding-right: 10px;" />
        </a>
        <p>
I was browsing around over lunch when I came across an upcoming title from Wrox that
I thought might be interesting to someone out there. 
</p>
        <p>
The book, being writing by <a href="http://www.embeddedpc.net/">Samuel Phung</a> of <a href="http://www.icop.com.tw/">ICOP</a>,
is titled <a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-047037733X.html">Professional
Microsoft Embedded CE 6.0</a>. A book like this is sorely needed as most of the knowledge
exists primarily in the embedded newsgroup or scattered around in a handful of blogs. 
</p>
        <p>
The 20-chapter book will cover everything from creating an image to development in
C# and VB.NET, as well as C++ and is scheduled to be released in November. Wrox have
made <a href="http://embeddedce60.wrox.com/wiki">a number of chapters available</a> through
their Wrox First subscription service.
</p>
        <img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=44952503-2a1e-41d3-a301-3da2cf7fc936" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/neilco/~4/9nLghZD7IEM" height="1" width="1" /></body>
      <title>Book: Professional Microsoft Embedded CE 6.0</title>
      <guid isPermaLink="false">http://blog.opennetcf.com/ncowburn/PermaLink,guid,44952503-2a1e-41d3-a301-3da2cf7fc936.aspx</guid>
      <link>http://feedproxy.google.com/~r/neilco/~3/9nLghZD7IEM/BookProfessionalMicrosoftEmbeddedCE60.aspx</link>
      <pubDate>Fri, 06 Jun 2008 14:03:39 GMT</pubDate>
      <description>&lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-047037733X.html"&gt;&lt;img src="http://blog.opennetcf.com/ncowburn/content/binary/SamBook.jpg" border="0" style="float: left; padding-right: 10px;"&gt;&lt;/a&gt;
&lt;p&gt;
I was browsing around over lunch when I came across an upcoming title from Wrox that
I thought might be interesting to someone out there. 
&lt;/p&gt;
&lt;p&gt;
The book, being writing by &lt;a href="http://www.embeddedpc.net/"&gt;Samuel Phung&lt;/a&gt; of &lt;a href="http://www.icop.com.tw/"&gt;ICOP&lt;/a&gt;,
is titled &lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-047037733X.html"&gt;Professional
Microsoft Embedded CE 6.0&lt;/a&gt;. A book like this is sorely needed as most of the knowledge
exists primarily in the embedded newsgroup or scattered around in a handful of blogs. 
&lt;/p&gt;
&lt;p&gt;
The 20-chapter book will cover everything from creating an image to development in
C# and VB.NET, as well as C++ and is scheduled to be released in November. Wrox have
made &lt;a href="http://embeddedce60.wrox.com/wiki"&gt;a number of chapters available&lt;/a&gt; through
their Wrox First subscription service.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.opennetcf.com/ncowburn/aggbug.ashx?id=44952503-2a1e-41d3-a301-3da2cf7fc936" /&gt;</description>
      <comments>http://blog.opennetcf.com/ncowburn/CommentView,guid,44952503-2a1e-41d3-a301-3da2cf7fc936.aspx</comments>
      <category>Books</category>
      <category>Mobility/Embedded</category>
      <category>OpenNETCF</category>
    <feedburner:origLink>http://blog.opennetcf.com/ncowburn/2008/06/06/BookProfessionalMicrosoftEmbeddedCE60.aspx</feedburner:origLink></item>
  </channel>
</rss>
