<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Programming for Vista, Part 1: Creating a Vista CommandLink in Managed Code</title>
	<atom:link href="http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/</link>
	<description>Graham O&#039;Neale – Deep In .NET Development: ASP.NET, MVC, jQuery, WPF, WCF, Silverlight</description>
	<lastBuildDate>Wed, 28 Sep 2011 23:00:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Graham O'Neale</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-77</link>
		<dc:creator>Graham O'Neale</dc:creator>
		<pubDate>Wed, 18 Feb 2009 03:46:38 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-77</guid>
		<description>@configurator: Got back on this problem and made the necessary fixes, slightly different to your suggested implementation. Thanks for the spot.</description>
		<content:encoded><![CDATA[<p>@configurator: Got back on this problem and made the necessary fixes, slightly different to your suggested implementation. Thanks for the spot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham O'Neale</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-84</link>
		<dc:creator>Graham O'Neale</dc:creator>
		<pubDate>Tue, 17 Feb 2009 23:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-84</guid>
		<description>Ps.  I see you everywhere configurator, first on Stack Overflow, now on my blog :) Not that I mind the traffic.... =)</description>
		<content:encoded><![CDATA[<p>Ps.  I see you everywhere configurator, first on Stack Overflow, now on my blog <img src='http://goneale.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Not that I mind the traffic&#8230;. =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham O'Neale</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-83</link>
		<dc:creator>Graham O'Neale</dc:creator>
		<pubDate>Tue, 17 Feb 2009 23:23:31 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-83</guid>
		<description>Oh sorry configurator, I briefly remember struggling with that and I believe I had to add ToString like you&#039;re indicating.  I think SendMessage_Bool() is still not completely right as we are just doing what we had before - running SendMessage() without IntPtr ToString() which results in &#039;IntPtr cannot convert to type string&#039;.</description>
		<content:encoded><![CDATA[<p>Oh sorry configurator, I briefly remember struggling with that and I believe I had to add ToString like you&#8217;re indicating.  I think SendMessage_Bool() is still not completely right as we are just doing what we had before &#8211; running SendMessage() without IntPtr ToString() which results in &#8216;IntPtr cannot convert to type string&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: configurator</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-82</link>
		<dc:creator>configurator</dc:creator>
		<pubDate>Tue, 17 Feb 2009 13:49:18 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-82</guid>
		<description>Oh, and it also uses this:

private static HandleRef GetHandleRef(Control control) {
			return new HandleRef(control, control.Handle);
		}</description>
		<content:encoded><![CDATA[<p>Oh, and it also uses this:</p>
<p>private static HandleRef GetHandleRef(Control control) {<br />
			return new HandleRef(control, control.Handle);<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: configurator</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-81</link>
		<dc:creator>configurator</dc:creator>
		<pubDate>Tue, 17 Feb 2009 13:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-81</guid>
		<description>Okay, I figured it out

You saw a code sample with new IntPtr(show ? 1 : 0) but your SendMessage accepts a string, so you used ToString. That is not the right thing to do - SetShieldIcon(false) will still set it to true. That is because the string is sent as a pointer and since both &quot;1&quot; and &quot;0&quot; are non-null pointers, they are both treated as TRUE. What you should do is call the SendMessage overload that accepts an IntPtr:

private static extern IntPtr SendMessage(HandleRef hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);

I used the following utility function, and it works:
public static IntPtr SendMessage_Bool(Control control, uint Msg, IntPtr wParam, bool lParam) {
			return SendMessage(GetHandleRef(control), Msg, wParam, new IntPtr(lParam ? 1 : 0));
		}</description>
		<content:encoded><![CDATA[<p>Okay, I figured it out</p>
<p>You saw a code sample with new IntPtr(show ? 1 : 0) but your SendMessage accepts a string, so you used ToString. That is not the right thing to do &#8211; SetShieldIcon(false) will still set it to true. That is because the string is sent as a pointer and since both &#8220;1&#8243; and &#8220;0&#8243; are non-null pointers, they are both treated as TRUE. What you should do is call the SendMessage overload that accepts an IntPtr:</p>
<p>private static extern IntPtr SendMessage(HandleRef hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);</p>
<p>I used the following utility function, and it works:<br />
public static IntPtr SendMessage_Bool(Control control, uint Msg, IntPtr wParam, bool lParam) {<br />
			return SendMessage(GetHandleRef(control), Msg, wParam, new IntPtr(lParam ? 1 : 0));<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: configurator</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-80</link>
		<dc:creator>configurator</dc:creator>
		<pubDate>Tue, 17 Feb 2009 13:38:39 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-80</guid>
		<description>You have an interesting line here:
new IntPtr(show ? 1 : 0).ToString()

Why not use the following instead?
show ? &quot;1&quot; : &quot;0&quot;</description>
		<content:encoded><![CDATA[<p>You have an interesting line here:<br />
new IntPtr(show ? 1 : 0).ToString()</p>
<p>Why not use the following instead?<br />
show ? &#8220;1&#8243; : &#8220;0&#8243;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Programming for Vista, Part 2: Adding Aero Glass in Managed Code &#171; {Programming} &#38; Life</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-79</link>
		<dc:creator>Programming for Vista, Part 2: Adding Aero Glass in Managed Code &#171; {Programming} &#38; Life</dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-79</guid>
		<description>[...] ui, vista, winforms, wpf    In part 1 of my Vista programming series I discussed how to add CommandLink&#8217;s to your application. In this chapter, part 2, I wish to discuss how you can enhance your Windows smart client [...]</description>
		<content:encoded><![CDATA[<p>[...] ui, vista, winforms, wpf    In part 1 of my Vista programming series I discussed how to add CommandLink&#8217;s to your application. In this chapter, part 2, I wish to discuss how you can enhance your Windows smart client [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Programming for Vista, Part 2: Adding Aero Glass in Managed Code &#171; {Programming} &#38; Life</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-78</link>
		<dc:creator>Programming for Vista, Part 2: Adding Aero Glass in Managed Code &#171; {Programming} &#38; Life</dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-78</guid>
		<description>[...] &amp; Life Just another WordPress.com weblog   AboutUseful    &#171; Programming for Vista, Part 1: Creating a Vista CommandLink in Managed&#160;Code Unexpected Results using InvokeRequired and Multi-threading Secrets&#160;Revealed! [...]</description>
		<content:encoded><![CDATA[<p>[...] &amp; Life Just another WordPress.com weblog   AboutUseful    &laquo; Programming for Vista, Part 1: Creating a Vista CommandLink in Managed&nbsp;Code Unexpected Results using InvokeRequired and Multi-threading Secrets&nbsp;Revealed! [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetShoutout</title>
		<link>http://goneale.com/2009/02/09/programming-for-vista-part-1-creating-a-vista-commandlink-in-managed-code/comment-page-1/#comment-76</link>
		<dc:creator>DotNetShoutout</dc:creator>
		<pubDate>Mon, 09 Feb 2009 11:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=241#comment-76</guid>
		<description>&lt;strong&gt;Programming for Vista, Part 1: Creating a CommandLink in Managed Code...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from DotNetShoutout...</description>
		<content:encoded><![CDATA[<p><strong>Programming for Vista, Part 1: Creating a CommandLink in Managed Code&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from DotNetShoutout&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

