<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   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:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>John Koerner's Page</title>
    <link>http://johnkoerner.net/</link>
    <description>Programming, Computers, etc...</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.2 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://johnkoerner.net/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: John Koerner's Page - Programming, Computers, etc...</title>
        <link>http://johnkoerner.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Creating a Firewall Exception in VB.Net</title>
    <link>http://johnkoerner.net/index.php?/archives/49-Creating-a-Firewall-Exception-in-VB.Net.html</link>
    
    <comments>http://johnkoerner.net/index.php?/archives/49-Creating-a-Firewall-Exception-in-VB.Net.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=49</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=49</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    	&lt;style&gt;
		.code {
			word-wrap:break-word;
			margin:10px;
			padding:10px;
			border:2px ridge white;
			background-color:#eeeeee;
			font-family:Courier New;
			font-size:10pt;
			}
	&lt;/style&gt;
Windows Vista and 7 provide a rather robust firewall API that can be used to add exceptions to the firewall.  The code below will add an exception to the windows firewall for the specified application, provided that the code is run with administrator privileges. Add a reference to &lt;b&gt;%systemroot%\system32\FirewallAPI.dll&lt;/b&gt; to your application.&lt;br /&gt;&lt;br /&gt;&lt;div class=&#039;code&#039;&gt;
&lt;font color=&#039;blue&#039;&gt;Imports&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;NetFwTypeLib&lt;br /&gt;
&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Public&amp;#160;Class&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Form1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Private&amp;#160;Sub&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Button1_Click(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;sender&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;System.&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Object&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;e&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;System.EventArgs)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Handles&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Button1.Click&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Create&amp;#160;the&amp;#160;Application&amp;#160;we&amp;#160;want&amp;#160;to&amp;#160;add&amp;#160;to&amp;#160;the&amp;#160;exception&amp;#160;list&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;appType&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Type&amp;#160;=&amp;#160;Type&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;.GetTypeFromProgID(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;HnetCfg.FwAuthorizedApplication&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;app&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;INetFwAuthorizedApplication&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;app&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;DirectCast(Activator.CreateInstance(appType),&amp;#160;INetFwAuthorizedApplication)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Set&amp;#160;the&amp;#160;application&amp;#160;properties&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;app.Name&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Negative0&#039;s&amp;#160;Sandbox&quot;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;app.ProcessImageFileName&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;C:\Users\Negative0\vbsandbox2.exe&quot;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;app.Enabled&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;True&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Get&amp;#160;the&amp;#160;firewall&amp;#160;manager,&amp;#160;so&amp;#160;we&amp;#160;can&amp;#160;get&amp;#160;the&amp;#160;list&amp;#160;of&amp;#160;authorized&amp;#160;apps&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;fwMgrType&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Type&amp;#160;=&amp;#160;Type&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;.GetTypeFromProgID(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;HnetCfg.FwMgr&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;fwMgr&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;INetFwMgr&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;fwMgr&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;DirectCast(Activator.CreateInstance(fwMgrType),&amp;#160;INetFwMgr)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Get&amp;#160;the&amp;#160;list&amp;#160;of&amp;#160;authorized&amp;#160;applications&amp;#160;from&amp;#160;the&amp;#160;Firewall&amp;#160;Manager,&amp;#160;so&amp;#160;we&amp;#160;can&amp;#160;add&amp;#160;our&amp;#160;app&amp;#160;to&amp;#160;that&amp;#160;list&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;apps&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;INetFwAuthorizedApplications&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;apps&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;fwMgr.LocalPolicy.CurrentProfile.AuthorizedApplications&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;apps.Add(app)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;Sub&lt;br /&gt;
&lt;br /&gt;
End&amp;#160;Class&lt;/font&gt;
	&lt;/div&gt;
	&lt;hr style=&#039;height:1px;background-color:#808080&#039; /&gt;
	&lt;span style=&#039;font-family:tahoma;font-size:8pt;color:#808080&#039;&gt;Colorized by: &lt;a style=&#039;color:#808080&#039; href=&quot;http://johnkoerner.net/exit.php?url_id=91&amp;amp;entry_id=49&quot; title=&quot;http://www.CarlosAg.net/Tools/CodeColorizer/&quot;  onmouseover=&quot;window.status=&#039;http://www.CarlosAg.net/Tools/CodeColorizer/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;CarlosAg.CodeColorizer&lt;/a&gt;&lt;/span&gt;

 
    </content:encoded>

    <pubDate>Mon, 21 Dec 2009 22:30:46 -0500</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/49-guid.html</guid>
    
</item>
<item>
    <title>Find Pixels on the screen by color without using GetPixel API.</title>
    <link>http://johnkoerner.net/index.php?/archives/48-Find-Pixels-on-the-screen-by-color-without-using-GetPixel-API..html</link>
    
    <comments>http://johnkoerner.net/index.php?/archives/48-Find-Pixels-on-the-screen-by-color-without-using-GetPixel-API..html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=48</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=48</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    Occasionally I need to write an app that reads pixels from the screen.  When searching small chunks of the screen, the windows GetPixel API works fine, but if I need to search the whole screen, that gets too slow.  One way that I have found that is about twice as fast as GetPixel is copying the screen to a bitmap and using the Bitmap&#039;s GetPixel method.  Below is an extension method that works with the Screen class to find pixels.
&lt;br /&gt;
	&lt;style&gt;
		.code {
			word-wrap:break-word;
			margin:10px;
			padding:10px;
			border:2px ridge white;
			background-color:#eeeeee;
			font-family:Courier New;
			font-size:10pt;
			}
	&lt;/style&gt;
&lt;div class=&#039;code&#039;&gt;
&lt;font color=&#039;blue&#039;&gt;Module&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenExtensions&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;lt;Extension()&amp;gt;&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Public&amp;#160;Function&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;FindPixelsByColor(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;CurrentScreen&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Screen,&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;SearchColor&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Color)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;List(Of&amp;#160;Point)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenBitmap&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Bitmap&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Nothing&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenCopier&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Graphics&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Nothing&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;If&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;CurrentScreen&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Is&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Nothing&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Then&amp;#160;Throw&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ArgumentException(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;The&amp;#160;screen&amp;#160;object&amp;#160;is&amp;#160;nothing.&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;If&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;SearchColor&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Color.Empty&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Then&amp;#160;Throw&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ArgumentException(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;The&amp;#160;search&amp;#160;color&amp;#160;is&amp;#160;empty.&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Try&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Initialize&amp;#160;our&amp;#160;output&amp;#160;of&amp;#160;points.&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;OutputPoints&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;List(Of&amp;#160;Point)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Create&amp;#160;the&amp;#160;bitmap&amp;#160;object&amp;#160;that&amp;#160;will&amp;#160;be&amp;#160;used&amp;#160;to&amp;#160;store&amp;#160;the&amp;#160;image&amp;#160;of&amp;#160;the&amp;#160;screen.&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenBitmap&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Bitmap(CurrentScreen.WorkingArea.Width,&amp;#160;CurrentScreen.WorkingArea.Height,&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Imaging.PixelFormat.Format32bppArgb)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Create&amp;#160;the&amp;#160;graphics&amp;#160;object&amp;#160;that&amp;#160;will&amp;#160;be&amp;#160;used&amp;#160;to&amp;#160;copy&amp;#160;the&amp;#160;screen&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenCopier&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Graphics.FromImage(ScreenBitmap)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Copy&amp;#160;from&amp;#160;the&amp;#160;screen&amp;#160;to&amp;#160;the&amp;#160;bitmap,&amp;#160;so&amp;#160;we&amp;#160;can&amp;#160;search&amp;#160;for&amp;#160;the&amp;#160;pixels&amp;#160;we&amp;#160;are&amp;#160;looking&amp;#160;for&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenCopier.CopyFromScreen(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Point(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;),&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Point(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;),&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Size(CurrentScreen.WorkingArea.Width,&amp;#160;CurrentScreen.WorkingArea.Height))&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenColor&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Color&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Loop&amp;#160;through&amp;#160;all&amp;#160;of&amp;#160;the&amp;#160;pixels&amp;#160;in&amp;#160;the&amp;#160;bitmap&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;For&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;x&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Integer&amp;#160;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;To&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;CurrentScreen.WorkingArea.Width&amp;#160;-&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;1&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;For&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;y&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Integer&amp;#160;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;To&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;CurrentScreen.WorkingArea.Height&amp;#160;-&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;1&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Get&amp;#160;the&amp;#160;color&amp;#160;at&amp;#160;the&amp;#160;current&amp;#160;pixel&amp;#160;from&amp;#160;the&amp;#160;screenshot.&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenColor&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenBitmap.GetPixel(x,&amp;#160;y)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Compare&amp;#160;the&amp;#160;color&amp;#160;from&amp;#160;the&amp;#160;screenshot&amp;#160;with&amp;#160;the&amp;#160;desired&amp;#160;color.&amp;#160;&amp;#160;We&amp;#160;need&amp;#160;to&amp;#160;level&amp;#160;off&amp;#160;the&amp;#160;alpha&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&#039;&amp;#160;for&amp;#160;this&amp;#160;compare&amp;#160;to&amp;#160;work&amp;#160;properly.&amp;#160;&amp;#160;All&amp;#160;colors&amp;#160;from&amp;#160;the&amp;#160;screenshot&amp;#160;have&amp;#160;an&amp;#160;alpha&amp;#160;of&amp;#160;255.&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;If&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenColor&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Color.FromArgb(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;255&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;SearchColor)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Then&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;If&amp;#160;we&amp;#160;have&amp;#160;a&amp;#160;match,&amp;#160;then&amp;#160;add&amp;#160;the&amp;#160;current&amp;#160;x,y&amp;#160;to&amp;#160;our&amp;#160;output.&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;OutputPoints.Add(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Point(x,&amp;#160;y))&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;If&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Next&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Next&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Return&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;OutputPoints&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Catch&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ex&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Exception&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Throw&amp;#160;New&amp;#160;Exception&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Unable&amp;#160;to&amp;#160;perform&amp;#160;pixel&amp;#160;search.&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;ex)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Finally&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;If&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenBitmap&amp;#160;IsNot&amp;#160;Nothing&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Then&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenBitmap.Dispose()&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;If&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenCopier&amp;#160;IsNot&amp;#160;Nothing&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Then&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ScreenCopier.Dispose()&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;Try&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;End&amp;#160;Function&lt;br /&gt;
End&amp;#160;Module&lt;/font&gt;
	&lt;/div&gt;
	&lt;hr style=&#039;height:1px;background-color:#808080&#039; /&gt;
	&lt;span style=&#039;font-family:tahoma;font-size:8pt;color:#808080&#039;&gt;Colorized by: &lt;a style=&#039;color:#808080&#039; href=&quot;http://johnkoerner.net/exit.php?url_id=90&amp;amp;entry_id=48&quot; title=&quot;http://www.CarlosAg.net/Tools/CodeColorizer/&quot;  onmouseover=&quot;window.status=&#039;http://www.CarlosAg.net/Tools/CodeColorizer/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;CarlosAg.CodeColorizer&lt;/a&gt;&lt;/span&gt;

	&lt;hr style=&#039;height:1px;background-color:#808080&#039; /&gt;

&lt;br /&gt;&lt;br /&gt;To use this class. You can simply call it from any screen object.  For example:
&lt;br /&gt;&lt;br /&gt;&lt;div class=&#039;code&#039;&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;l&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;List(Of&amp;#160;Point)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;l&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Screen.PrimaryScreen.FindPixelsByColor(Color.FromArgb(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;128&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;128&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;128&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;))&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;MessageBox.Show(l.Count.ToString())&lt;/font&gt;
	&lt;/div&gt;
	&lt;hr style=&#039;height:1px;background-color:#808080&#039; /&gt;
	&lt;span style=&#039;font-family:tahoma;font-size:8pt;color:#808080&#039;&gt;Colorized by: &lt;a style=&#039;color:#808080&#039; href=&quot;http://johnkoerner.net/exit.php?url_id=90&amp;amp;entry_id=48&quot; title=&quot;http://www.CarlosAg.net/Tools/CodeColorizer/&quot;  onmouseover=&quot;window.status=&#039;http://www.CarlosAg.net/Tools/CodeColorizer/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;CarlosAg.CodeColorizer&lt;/a&gt;&lt;/span&gt;

&lt;br /&gt;	 
    </content:encoded>

    <pubDate>Sun, 29 Nov 2009 22:27:00 -0500</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/48-guid.html</guid>
    
</item>
<item>
    <title>Taking a screenshot in VB.Net</title>
    <link>http://johnkoerner.net/index.php?/archives/47-Taking-a-screenshot-in-VB.Net.html</link>
    
    <comments>http://johnkoerner.net/index.php?/archives/47-Taking-a-screenshot-in-VB.Net.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=47</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=47</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    Taking a screenshot from a .Net app is very easy.  The function to use is the CopyFromScreen function from the Graphics class.
&lt;br /&gt;&lt;br /&gt;
	&lt;style&gt;
		.code {
			word-wrap:break-word;
			margin:10px;
			padding:10px;
			border:2px ridge white;
			background-color:#eeeeee;
			font-family:Courier New;
			font-size:10pt;
			}
	&lt;/style&gt;&lt;div class=&#039;code&#039;&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;b&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Bitmap&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;Hide&amp;#160;the&amp;#160;form,&amp;#160;so&amp;#160;it&amp;#160;doesn&#039;t&amp;#160;show&amp;#160;in&amp;#160;the&amp;#160;screenshot&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Me&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;.Hide()&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;b&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Bitmap(My.Computer.Screen.WorkingArea.Width,&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;My.Computer.Screen.WorkingArea.Height,&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Imaging.PixelFormat.Format32bppArgb)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;g&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Graphics&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Graphics.FromImage(b)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;g.CopyFromScreen(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Point(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;),&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Point(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;0&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;),&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Size(My.Computer.Screen.WorkingArea.Width,&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;My.Computer.Screen.WorkingArea.Height))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;Show&amp;#160;the&amp;#160;form&amp;#160;again&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Me&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;.Show()&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;Save&amp;#160;the&amp;#160;file&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ofd&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;SaveFileDialog&amp;#160;()&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;ofd.Filter&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;(*.bmp)|*.bmp&quot;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;If&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ofd.ShowDialog()&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Windows.Forms.DialogResult.OK&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Then&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;b.Save(ofd.FileName)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;If&amp;#160;&lt;/font&gt;
	&lt;/div&gt;
	&lt;hr style=&#039;height:1px;background-color:#808080&#039; /&gt;
	&lt;span style=&#039;font-family:tahoma;font-size:8pt;color:#808080&#039;&gt;Colorized by: &lt;a style=&#039;color:#808080&#039; href=&quot;http://johnkoerner.net/exit.php?url_id=92&amp;amp;entry_id=47&quot; title=&quot;http://www.CarlosAg.net/Tools/CodeColorizer/&quot;  onmouseover=&quot;window.status=&#039;http://www.CarlosAg.net/Tools/CodeColorizer/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;CarlosAg.CodeColorizer&lt;/a&gt;&lt;/span&gt;
 
    </content:encoded>

    <pubDate>Sat, 14 Mar 2009 13:24:00 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/47-guid.html</guid>
    
</item>
<item>
    <title>Using the ShowWindow API on a VB6 App from .Net</title>
    <link>http://johnkoerner.net/index.php?/archives/46-Using-the-ShowWindow-API-on-a-VB6-App-from-.Net.html</link>
    
    <comments>http://johnkoerner.net/index.php?/archives/46-Using-the-ShowWindow-API-on-a-VB6-App-from-.Net.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=46</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=46</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    I was helping someone with an issue &lt;a href=&quot;http://johnkoerner.net/exit.php?url_id=88&amp;amp;entry_id=46&quot; title=&quot;http://www.vbforums.com/showthread.php?t=557314&quot;  onmouseover=&quot;window.status=&#039;http://www.vbforums.com/showthread.php?t=557314&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;restoring &lt;/a&gt; vb6 windows from a .Net application over on &lt;a href=&quot;http://johnkoerner.net/exit.php?url_id=89&amp;amp;entry_id=46&quot; title=&quot;http://www.vbforums.com&quot;  onmouseover=&quot;window.status=&#039;http://www.vbforums.com&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;VBForums&lt;/a&gt;.  The issue ended up being that the MainWindowHandle of the process was returning the window handle for the ThunderRT6Main window.  The ThunderRT6Main is a hidden window that all VB6 apps have that is used for message processing.  When we called ShowWindow against this window handle, nothing would happen.  To get around this, I ended up calling the GetWindow API with a GW_HWNDPREV to get the window handle of the form window and then called ShowWindow on that.&lt;br /&gt;&lt;br /&gt;
	&lt;div class=&#039;code&#039;&gt;
&amp;#160;&lt;font color=&#039;blue&#039;&gt;Private&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;SW_SHOWNORMAL&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Integer&amp;#160;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;&amp;H1&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;lt;Runtime.InteropServices.DllImport(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;user32&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;EntryPoint:&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;ShowWindow&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&amp;gt;&amp;#160;_&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Private&amp;#160;Shared&amp;#160;Function&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ShowWindow(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;hwnd&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;IntPtr,&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;nCmdShow&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Integer&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Integer&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;End&amp;#160;Function&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Declare&amp;#160;Auto&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Function&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;GetWindow&amp;#160;Lib&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;user32.dll&quot;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;(&amp;#160;_&lt;br /&gt;
&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;hWnd&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;IntPtr,&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;uCmd&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;UInt32)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;IntPtr&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Const&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;GW_HWNDPREV&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;Integer&amp;#160;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;3&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;proc&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;New&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Process&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Private&amp;#160;Sub&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Button1_Click(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;sender&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;System.&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Object&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;e&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;System.EventArgs)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Handles&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Button1.Click&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Start&amp;#160;the&amp;#160;process&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;With&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;proc&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;.StartInfo.FileName&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;c:\temp\project1.exe&quot;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;.Start()&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;With&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Wait&amp;#160;for&amp;#160;it&amp;#160;to&amp;#160;finish&amp;#160;loading&amp;#160;and&amp;#160;put&amp;#160;the&amp;#160;window&amp;#160;handle&amp;#160;into&amp;#160;the&amp;#160;form&amp;#160;caption&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;proc.WaitForInputIdle(&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;10000&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Me&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;.Text&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;proc.MainWindowHandle.ToString(&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;x8&quot;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;Private&amp;#160;Sub&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Button2_Click(&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;sender&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;System.&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Object&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;,&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;ByVal&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;e&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;System.EventArgs)&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Handles&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Button2.Click&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Call&amp;#160;GetWindow&amp;#160;with&amp;#160;GW_HWNDPREV&amp;#160;to&amp;#160;get&amp;#160;the&amp;#160;form&amp;#160;from&amp;#160;the&amp;#160;ThunderRT6Main&amp;#160;window&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;Dim&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;vb6Window&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;As&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;IntPtr&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;GetWindow(proc.MainWindowHandle,&amp;#160;GW_HWNDPREV)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;darkgreen&#039;&gt;&#039;&amp;#160;Call&amp;#160;ShowWindow&amp;#160;on&amp;#160;the&amp;#160;window&amp;#160;we&amp;#160;got&amp;#160;back&amp;#160;from&amp;#160;the&amp;#160;last&amp;#160;call,&amp;#160;which&amp;#160;should&amp;#160;be&amp;#160;the&amp;#160;ThunderRT6FormDC&amp;#160;window&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;ShowWindow(vb6Window,&amp;#160;SW_SHOWNORMAL)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;End&amp;#160;Sub&lt;/font&gt;
	&lt;/div&gt; 
    </content:encoded>

    <pubDate>Thu, 12 Feb 2009 22:14:00 -0500</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/46-guid.html</guid>
    
</item>
<item>
    <title>Keyboard Listener</title>
    <link>http://johnkoerner.net/index.php?/archives/45-Keyboard-Listener.html</link>
    
    <comments>http://johnkoerner.net/index.php?/archives/45-Keyboard-Listener.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=45</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=45</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    Whenever I need to write a keyboard listener, I always have to go back and search through old code to get the exact syntax.  I then end up copying and pasting a whole bunch of code.  I decided it was time to create a DLL that will handle all of this work for me.  I also decided that I will post the DLL up here for anyone to use as they see fit.
&lt;br /&gt;&lt;br /&gt;
The DLL is copyrighted, however, it is free for distribution with personal or commercial applications.
&lt;br /&gt;&lt;br /&gt;
The setup package, which includes a help file, a sample app, and the DLL, can be downloaded from the downloads page, or from the link below.
&lt;br /&gt;&lt;br /&gt;

Download: &lt;a href=&quot;http://johnkoerner.net/exit.php?url_id=87&amp;amp;entry_id=45&quot; title=&quot;http://johnkoerner.com/dl/KeyboardListener.msi&quot;  onmouseover=&quot;window.status=&#039;http://johnkoerner.com/dl/KeyboardListener.msi&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;KeyboardListener.msi&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;
The sample app shows off the basic functionality of listening for one particular key, a set number of keys, or all key presses on a system.  Below is a screenshot of the sample application.  This dll works system wide, not just within the application that is using it.
&lt;br /&gt;&lt;br /&gt;
&lt;img src=&quot;http://www.johnkoerner.com/images/KeyboardListenerForm.png&quot; alt=&quot;&quot; /&gt; 
    </content:encoded>

    <pubDate>Mon, 24 Nov 2008 15:30:28 -0500</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/45-guid.html</guid>
    
</item>
<item>
    <title>Creating a Plugin Architecture in C#</title>
    <link>http://johnkoerner.net/index.php?/archives/43-Creating-a-Plugin-Architecture-in-C.html</link>
            <category>C#</category>
            <category>Programming</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/43-Creating-a-Plugin-Architecture-in-C.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=43</wfw:comment>

    <slash:comments>13</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=43</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    Creating a plugin architecture in a C# application is a fairly easy task.  The video below will walk you through the process of setting up the plugin architecture and it will implement a simple plugin.
&lt;br /&gt;&lt;br /&gt;
&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; width=&quot;800&quot; height=&quot;618&quot;&gt; &lt;param name=&quot;movie&quot; value=&quot;http://content.screencast.com/bootstrap.swf&quot;&gt;&lt;/param&gt; &lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;&lt;/param&gt; &lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot;&gt;&lt;/param&gt; &lt;param name=&quot;flashVars&quot; value=&quot;thumb=http://content.screencast.com/media/b304898a-52aa-42a9-8fec-d08f3b8abad4_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Thumbnail.gif&amp;content=http://content.screencast.com/media/89d0bc8f-67b9-4087-a0a5-02d5fd684aa0_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_2008-07-19_2228%20Creating%20a%20plugin%20interface%20in%20C#.swf&amp;width=800&amp;height=618&quot;&gt;&lt;/param&gt; &lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt; &lt;param name=&quot;scale&quot; value=&quot;showall&quot;&gt;&lt;/param&gt; &lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;  &lt;embed src=&quot;http://content.screencast.com/bootstrap.swf&quot; quality=&quot;high&quot; bgcolor=&quot;#FFFFFF&quot; width=&quot;800&quot; height=&quot;618&quot; type=&quot;application/x-shockwave-flash&quot; allowScriptAccess=&quot;always&quot; flashVars=&quot;thumb=http://content.screencast.com/media/b304898a-52aa-42a9-8fec-d08f3b8abad4_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Thumbnail.gif&amp;content=http://content.screencast.com/media/89d0bc8f-67b9-4087-a0a5-02d5fd684aa0_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_2008-07-19_2228%20Creating%20a%20plugin%20interface%20in%20C#.swf&amp;width=800&amp;height=618&quot; allowFullScreen=&quot;true&quot; scale=&quot;showall&quot;&gt;&lt;/embed&gt; &lt;/object&gt;
&lt;br /&gt;&lt;br /&gt;
The source for the project can be downloaded &lt;a href=&quot;http://johnkoerner.net/uploads/PulginExample-ImageViewer.zip&quot; title=&quot;PulginExample-ImageViewer.zip&quot; target=&quot;_blank&quot;&gt;Here&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Mon, 21 Jul 2008 19:22:00 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/43-guid.html</guid>
    
</item>
<item>
    <title>Conditionally Formatting ComboBox Items in C#</title>
    <link>http://johnkoerner.net/index.php?/archives/42-Conditionally-Formatting-ComboBox-Items-in-C.html</link>
            <category>C#</category>
            <category>Programming</category>
            <category>Windows</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/42-Conditionally-Formatting-ComboBox-Items-in-C.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=42</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=42</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    The video below gives an overview of creating a ComboBox that does conditional formatting.  The code uses regular expressions to determine if an item in a combobox should have special formatting.  The code is nowhere near production ready, but it should give you an idea of how to do formatting of items in a combobox drop down list.  See the full post if you want to copy the code.&lt;br /&gt;&lt;br /&gt;

&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; width=&quot;800&quot; height=&quot;618&quot;&gt; &lt;param name=&quot;movie&quot; value=&quot;http://content.screencast.com/bootstrap.swf&quot;&gt;&lt;/param&gt; &lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;&lt;/param&gt; &lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot;&gt;&lt;/param&gt; &lt;param name=&quot;flashVars&quot; value=&quot;thumb=http://content.screencast.com/media/96f49c69-a937-4937-9b1b-cf8aa0fd9f9c_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Thumbnail.gif&amp;content=http://content.screencast.com/media/bb11c7d8-d9f2-433d-87b1-e0054d19eb09_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_2008-07-08_2232%20-%20Combobox%20Drawing.swf&amp;width=800&amp;height=618&quot;&gt;&lt;/param&gt; &lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt; &lt;param name=&quot;scale&quot; value=&quot;showall&quot;&gt;&lt;/param&gt; &lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;  &lt;embed src=&quot;http://content.screencast.com/bootstrap.swf&quot; quality=&quot;high&quot; bgcolor=&quot;#FFFFFF&quot; width=&quot;800&quot; height=&quot;618&quot; type=&quot;application/x-shockwave-flash&quot; allowScriptAccess=&quot;always&quot; flashVars=&quot;thumb=http://content.screencast.com/media/96f49c69-a937-4937-9b1b-cf8aa0fd9f9c_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Thumbnail.gif&amp;content=http://content.screencast.com/media/bb11c7d8-d9f2-433d-87b1-e0054d19eb09_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_2008-07-08_2232%20-%20Combobox%20Drawing.swf&amp;width=800&amp;height=618&quot; allowFullScreen=&quot;true&quot; scale=&quot;showall&quot;&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://johnkoerner.net/index.php?/archives/42-Conditionally-Formatting-ComboBox-Items-in-C.html#extended&quot;&gt;Continue reading &quot;Conditionally Formatting ComboBox Items in C#&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue,  8 Jul 2008 22:54:41 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/42-guid.html</guid>
    
</item>
<item>
    <title>New Download Available</title>
    <link>http://johnkoerner.net/index.php?/archives/41-New-Download-Available.html</link>
    
    <comments>http://johnkoerner.net/index.php?/archives/41-New-Download-Available.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=41</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    I have added a SCORM compliant version of the &lt;a href=&quot;index.php?/archives/40-Creating-Content-for-the-SharePoint-Learning-Kit.html#extended&quot;&gt;Creating Content for the SharePoint Learning Kit&lt;/a&gt; video to the &lt;a href=index.php?/archives/23-Downloads.html&gt;downloads&lt;/a&gt; page if you would like to have a copy of it in your own SharePoint site. 
    </content:encoded>

    <pubDate>Wed, 11 Jun 2008 23:55:08 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/41-guid.html</guid>
    
</item>
<item>
    <title>Creating Content for the SharePoint Learning Kit</title>
    <link>http://johnkoerner.net/index.php?/archives/40-Creating-Content-for-the-SharePoint-Learning-Kit.html</link>
            <category>SharePoint</category>
            <category>SLK</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/40-Creating-Content-for-the-SharePoint-Learning-Kit.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=40</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    Here is a new video demonstrating how to create SCORM content for the SharePoint Learning Kit.&lt;br /&gt;&lt;br /&gt;
&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; width=&quot;800&quot; height=&quot;618&quot;&gt; &lt;param name=&quot;movie&quot; value=&quot;http://content.screencast.com/bootstrap.swf&quot;&gt;&lt;/param&gt; &lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;&lt;/param&gt; &lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot;&gt;&lt;/param&gt; &lt;param name=&quot;flashVars&quot; value=&quot;thumb=http://content.screencast.com/media/e36ac792-8b0e-4b3d-a9ea-ddc8c33b96f3_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Thumbnail.gif&amp;content=http://content.screencast.com/media/8a0452c4-c0bf-44e8-9663-0c5cf8a8fbdb_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Creating%20Content%20for%20the%20Sharepoint%20Learning%20Kit.swf&amp;width=800&amp;height=618&quot;&gt;&lt;/param&gt; &lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt; &lt;param name=&quot;scale&quot; value=&quot;showall&quot;&gt;&lt;/param&gt; &lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;  &lt;embed src=&quot;http://content.screencast.com/bootstrap.swf&quot; quality=&quot;high&quot; bgcolor=&quot;#FFFFFF&quot; width=&quot;800&quot; height=&quot;618&quot; type=&quot;application/x-shockwave-flash&quot; allowScriptAccess=&quot;always&quot; flashVars=&quot;thumb=http://content.screencast.com/media/e36ac792-8b0e-4b3d-a9ea-ddc8c33b96f3_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Thumbnail.gif&amp;content=http://content.screencast.com/media/8a0452c4-c0bf-44e8-9663-0c5cf8a8fbdb_580137e2-a83d-47da-bd2e-169abe0ae4ba_static_0_0_Creating%20Content%20for%20the%20Sharepoint%20Learning%20Kit.swf&amp;width=800&amp;height=618&quot; allowFullScreen=&quot;true&quot; scale=&quot;showall&quot;&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;


Resources:&lt;br /&gt;
	&lt;a href=http://www.scorm.com/products/scormdriverauthoring.aspx&gt;SCORM Simple Content API &lt;/a&gt; &lt;br /&gt;
	&lt;a href=http://www.jingproject.com&gt;Jing Project &lt;/a&gt;&lt;br /&gt;
	&lt;a href=http://www.codeplex.com/SLK&gt;SharePoint Learning Kit&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Mon,  9 Jun 2008 23:36:15 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/40-guid.html</guid>
    
</item>
<item>
    <title>MOSS: Adding sub navigation</title>
    <link>http://johnkoerner.net/index.php?/archives/39-MOSS-Adding-sub-navigation.html</link>
            <category>SharePoint</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/39-MOSS-Adding-sub-navigation.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=39</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=39</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    I found a nice little &lt;a href=http://www.heathersolomon.com/blog/archive/2007/05/15/SharePoint-Tip--How-to-Activate-the-Drop-Down-Menu.aspx&gt;post&lt;/a&gt; from Heather Solomon on allowing SharePoint to have multiple levels of sub navigation.  It works really well, but the navigation editor in MOSS does not let you nest sub-menus by default.  I wrote a quick little C# app that allowed me to add navigation as needed.  Here is the meat of the code.&lt;br /&gt;
&lt;br /&gt;
            SPNavigationNode oNewNode = new SPNavigationNode(&quot;My New Tab3&quot;,&quot;&quot;);&lt;br /&gt;
            oWeb.Navigation.TopNavigationBar.AddAsLast(oNewNode);&lt;br /&gt;
            oNewNode.Properties.Add(&quot;NodeType&quot;,&quot;Heading&quot;);&lt;br /&gt;
            oNewNode.Update();&lt;br /&gt;
&lt;br /&gt;
            SPNavigationNode oChild1 = new SPNavigationNode(&quot;C1&quot;,&quot;/&quot;);&lt;br /&gt;
            oNewNode.Children.AddAsFirst(oChild1);&lt;br /&gt;
            oChild1.Properties.Add(&quot;NodeType&quot;,&quot;Heading&quot;);&lt;br /&gt;
            oChild1.Update();&lt;br /&gt;
&lt;br /&gt;
            SPNavigationNode oChild2 = new SPNavigationNode(&quot;C2&quot;,&quot;/&quot;);&lt;br /&gt;
            oChild1.Children.AddAsFirst(oChild2);&lt;br /&gt;
&lt;br /&gt;
Note: I have only tested this on MOSS 2007 and it did some weird things to my tab highlighting that I haven&#039;t figured out yet. 
    </content:encoded>

    <pubDate>Sat, 17 May 2008 16:42:59 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/39-guid.html</guid>
    
</item>
<item>
    <title>Visual Studio Extensions for Sharepoint - ListDefinition1</title>
    <link>http://johnkoerner.net/index.php?/archives/38-Visual-Studio-Extensions-for-Sharepoint-ListDefinition1.html</link>
            <category>C#</category>
            <category>SharePoint</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/38-Visual-Studio-Extensions-for-Sharepoint-ListDefinition1.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=38</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=38</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    If you have used the Visual Studio Extensions for Sharepoint to create more than one list, then you will probably be familiar with the problem of all custom List Definitions are given the name ListDefinition1.  This causes problems when you activate the feature, because SharePoint already thinks ListDefinition1 exists.
&lt;br /&gt;&lt;br /&gt;
To fix this problem, there are a few things that need to be changed in your project.
&lt;br /&gt;&lt;br /&gt;
1.) Rename the ListDefinition1 folder in your solution.
&lt;br /&gt;2.) Change the URL in the Instance.XML.  You&#039;ll probably want to change the display name as well, but that is not necessary.
&lt;br /&gt;3.) Change the Name in the ListDefinition.xml.  Again, you&#039;ll probably want to change the display name as well.
&lt;br /&gt;&lt;br /&gt;
Some things to keep in mind are that the display name column is used in one of the folder names that is created by the extensions, so if you use a character that SharePoint doesn&#039;t like (i.e. an apostrophe) you will get an error.
&lt;br /&gt;&lt;br /&gt;
If you get an error when deploying, your best bet is to fix the error in VS, delete the PKG folder, and then rebuild and deploy your solution. 
    </content:encoded>

    <pubDate>Sun, 20 Apr 2008 11:46:03 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/38-guid.html</guid>
    
</item>
<item>
    <title>MOSS XSL for ItemStyles</title>
    <link>http://johnkoerner.net/index.php?/archives/37-MOSS-XSL-for-ItemStyles.html</link>
            <category>SharePoint</category>
            <category>SharePoint Designer</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/37-MOSS-XSL-for-ItemStyles.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=37</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    I found a nice little snippet on &lt;a href=http://www.heathersolomon.com/blog/articles/customitemstyle.aspx&gt;Heather Solomon&#039;s site&lt;/a&gt; for  customizing the CQWP.  She had a nice little debugging XSL style for items to see what properties were available. &lt;br /&gt;&lt;br /&gt;
After doing a little digging with the XSL, I enhanced it just a bit, so I could get both the parameter name and the value:&lt;br /&gt;&lt;br /&gt;
	&lt;div class=&#039;code&#039;&gt;
&lt;font color=&#039;blue&#039;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;xsl:template&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;name&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&quot;Debug&quot;&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;match&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&quot;Row[@Style=&#039;Debug&#039;]&quot;&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;mode&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&quot;itemstyle&quot;&amp;gt;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;xsl:for-each&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;select&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&quot;@*&quot;&amp;gt;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;P:&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;xsl:value-of&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;select&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&quot;name()&quot;&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;/&gt;=&amp;lt;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;xsl:value-of&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;&amp;#160;select&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&quot;.&quot;/&gt;&amp;#160;&amp;lt;&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;br&lt;/font&gt;&lt;font color=&#039;red&#039;&gt;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;/&gt;&lt;br /&gt;
&amp;lt;/&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;xsl:for-each&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;&amp;lt;/&lt;/font&gt;&lt;font color=&#039;maroon&#039;&gt;xsl:template&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;&lt;/font&gt;
	&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;

The output then looks like:&lt;br /&gt;&lt;br /&gt;

P:ListId=FF486727-3DD6-4FFB-A5F5-B9A922366E9E
&lt;br /&gt;P:WebId=FF7C38FA-BBAA-4240-9A2B-63B8F508C780
&lt;br /&gt;P:ID=1
&lt;br /&gt;P:&lt;u&gt;x007B_ff564e0f_x002D_0c70_x002D_4ab9_x002D_b863_x002D_0177e6ddd247_x007D&lt;/u&gt;=Welcome to your Project Diary!
&lt;br /&gt;P:FileRef=Customers/Customer1/CustomerProject/Lists/Posts/1_.000
&lt;br /&gt;P:&lt;u&gt;x007B_ff22ea11_x002D_1e32_x002D_424e_x002D_89ab_x002D_9fedbadb6ce1_x007D&lt;/u&gt;=1
&lt;br /&gt;P:Modified=2008-03-25 12:50:55
&lt;br /&gt;P:Author=System Account
&lt;br /&gt;P:Editor=System Account
&lt;br /&gt;P:Created=2008-03-25 12:42:02
&lt;br /&gt;P:PublishingRollupImage= 
    </content:encoded>

    <pubDate>Thu, 17 Apr 2008 12:33:13 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/37-guid.html</guid>
    
</item>
<item>
    <title>Showing Items Without Folders in the DataView Web Part</title>
    <link>http://johnkoerner.net/index.php?/archives/36-Showing-Items-Without-Folders-in-the-DataView-Web-Part.html</link>
            <category>SharePoint</category>
            <category>SharePoint Designer</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/36-Showing-Items-Without-Folders-in-the-DataView-Web-Part.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=36</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=36</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    I have a dataview web part (aka dataform web part) pointed to a list with items that are all in sub folders.  By default the web part displays just the items from the root folder.  I did some searching on the net and found people had this problem with CAML queries and that they had to set the Scope property of the query to Recursive.  Since I was doing this through the SharePoint designer, I had to figure out where to set the property.  To save everyone else (and myself in the future) some time, here is how I did it:
&lt;br /&gt;&lt;br /&gt;
Open up the page in split or code view.  Scroll to the SharePoint:SPDataSource object inside of your DataFormWebPart.
&lt;br /&gt;&lt;br /&gt;
&lt;!-- s9ymdb:5 --&gt;&lt;img width=&quot;618&quot; height=&quot;71&quot; style=&quot;border: 0px; padding-left: 5px; padding-right: 5px;&quot; src=&quot;http://johnkoerner.net/uploads/SPD-CodeView.PNG&quot; alt=&quot;&quot; /&gt;
&lt;br /&gt;&lt;br /&gt;
Click somewhere inside the SPDataSource tag.  This will bring up the tag properties window on the left.  From here you can set your scope property.
&lt;br /&gt;&lt;br /&gt;
&lt;!-- s9ymdb:6 --&gt;&lt;img width=&quot;386&quot; height=&quot;335&quot; style=&quot;border: 0px; padding-left: 5px; padding-right: 5px;&quot; src=&quot;http://johnkoerner.net/uploads/SPDRecursive.png&quot; alt=&quot;&quot; /&gt;
&lt;br /&gt;&lt;br /&gt;
The four properties are documented in the MSDN library in the &lt;a href=http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spviewscope.aspx&gt;SPViewScope&lt;/a&gt; enumeration.

 
    </content:encoded>

    <pubDate>Thu,  3 Apr 2008 20:09:00 -0400</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/36-guid.html</guid>
    
</item>
<item>
    <title>MOSS - The specified account name is invalid</title>
    <link>http://johnkoerner.net/index.php?/archives/35-MOSS-The-specified-account-name-is-invalid.html</link>
            <category>SharePoint</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/35-MOSS-The-specified-account-name-is-invalid.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=35</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=35</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    I have been building a Virtual Machine for my MOSS development and testing.  I had not configured active directory on the machine, but one piece of software required it for me to continue.   So I setup my machine as a domain controller and created a domain called VMDomain.  This worked and everything seemed fine.  I then went to do some work in sharepoint and noticed that some features were erroring out.  I checked the event viewer and had quite a few messages in there stating &quot;The specified account name is invalid.&quot;  I also had other errors about usernames not mapping to security IDs.  I was positive that this was something that had been broken because of the domain change.  I changed accounts on services, application pools, and anything else I could find, but I was still getting those errors every few minutes.&lt;br /&gt;&lt;br /&gt;I googled the errors I was getting, but didn&#039;t really get any good results.  Finally, I was messing around in central admin, when I noticed one screen that I had not been in yet.  Under the operations tab, under the Security Configurations group, the Service Accounts item.  I selected Web Application Pool and then selected the Sharepoint - 80 app pool and modified the ID and password.  After making the update, all of my event viewer errors seemed to go away.  
    </content:encoded>

    <pubDate>Thu, 20 Dec 2007 13:35:02 -0500</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/35-guid.html</guid>
    
</item>
<item>
    <title>Powershell Stopwatch</title>
    <link>http://johnkoerner.net/index.php?/archives/34-Powershell-Stopwatch.html</link>
            <category>Powershell</category>
    
    <comments>http://johnkoerner.net/index.php?/archives/34-Powershell-Stopwatch.html#comments</comments>
    <wfw:comment>http://johnkoerner.net/wfwcomment.php?cid=34</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://johnkoerner.net/rss.php?version=2.0&amp;type=comments&amp;cid=34</wfw:commentRss>
    

    <author>nospam@example.com (JohnKoer)</author>
    <content:encoded>
    So I needed a stopwatch today to time a project I was working on, so I decided to write a quick PS script to do it for me:
&lt;br /&gt;
&lt;br /&gt;
	&lt;style&gt;
		.code {
			word-wrap:break-word;
			margin:10px;
			padding:10px;
			border:2px ridge white;
			background-color:#eeeeee;
			font-family:Courier New;
			font-size:10pt;
			}
	&lt;/style&gt;

	&lt;div class=&#039;code&#039;&gt;
&lt;font color=&#039;black&#039;&gt;function&amp;#160;global:StopWatch()&lt;br /&gt;
{&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Create&amp;#160;the&amp;#160;stopwatch&lt;br /&gt;
&amp;#160;&amp;#160;[System.Diagnostics.Stopwatch]&amp;#160;$sw&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;;&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;$sw&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;New-Object&amp;#160;System.Diagnostics.StopWatch&lt;br /&gt;
&amp;#160;&amp;#160;$sw.Start()&lt;br /&gt;
&amp;#160;&amp;#160;write-host&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Press&amp;#160;enter&amp;#160;to&amp;#160;stop...&quot;&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Wait&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;for&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;input,&amp;#160;and&amp;#160;we&amp;#160;will&amp;#160;just&amp;#160;disregard&amp;#160;anything&amp;#160;they&amp;#160;type&lt;br /&gt;
&amp;#160;&amp;#160;$blah&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;=&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;read-host&lt;br /&gt;
&amp;#160;&amp;#160;$sw.Stop()&lt;br /&gt;&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Write&amp;#160;the&amp;#160;compact&amp;#160;output&amp;#160;to&amp;#160;the&amp;#160;screen&lt;br /&gt;
&amp;#160;&amp;#160;write-host&amp;#160;$sw.Elapsed.ToString()&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;Write&amp;#160;verbose&amp;#160;output&amp;#160;to&amp;#160;screen&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;write-host&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Days:&quot;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;$sw.Elapsed.Days.ToString()&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;write-host&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Hours:&quot;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;$sw.Elapsed.Hours.ToString()&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;write-host&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Minutes:&quot;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;$sw.Elapsed.Minutes.ToString()&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;write-host&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Seconds:&quot;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;$sw.Elapsed.Seconds.ToString()&lt;br /&gt;
&amp;#160;&amp;#160;&lt;/font&gt;&lt;font color=&#039;blue&#039;&gt;#&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;write-host&amp;#160;&lt;/font&gt;&lt;font color=&#039;#808080&#039;&gt;&quot;Milliseconds:&quot;&amp;#160;&lt;/font&gt;&lt;font color=&#039;black&#039;&gt;$sw.Elapsed.Milliseconds.ToString()&lt;br /&gt;
}&lt;/font&gt;
	&lt;/div&gt; 
    </content:encoded>

    <pubDate>Mon,  3 Dec 2007 20:14:26 -0500</pubDate>
    <guid isPermaLink="false">http://johnkoerner.net/index.php?/archives/34-guid.html</guid>
    
</item>

</channel>
</rss>