<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>void Nish(char* szBlog);</title>
	<atom:link href="http://blog.voidnish.com/wp-rss2.php" rel="self" type="application/rss+xml" />
	<link>http://blog.voidnish.com</link>
	<description>Nish's thoughts on MFC, C++/CLI and .NET</description>
	<pubDate>Mon, 14 Jul 2008 03:01:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>WPF : Opaque child windows on a transparent parent background</title>
		<link>http://blog.voidnish.com/?p=174</link>
		<comments>http://blog.voidnish.com/?p=174#comments</comments>
		<pubDate>Mon, 14 Jul 2008 02:57:57 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[Avalon]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=174</guid>
		<description><![CDATA[If you set a parent window&#8217;s Opacity, any child windows can only have an opacity equal to or below the parent window&#8217;s. So if you want to keep the main window background transparent but leave the child controls (such as a text box) fully opaque, it will not work as you expect. One solution (there [...]]]></description>
			<content:encoded><![CDATA[<p>If you set a parent window&#8217;s <code>Opacity</code>, any child windows can only have an opacity equal to or below the parent window&#8217;s. So if you want to keep the main window background transparent but leave the child controls (such as a text box) fully opaque, it will not work as you expect. One solution (there are possibly others too) is to do the following.</p>
<p>Set the main window&#8217;s <code>AllowTransparency </code>to <code>true </code>and set the <code>Background </code>to <code>Transparent</code>.</p>
<pre>&lt;Window . . .
    AllowsTransparency=<span class="string">"True"</span> Background=<span class="string">"Transparent"</span>
    &gt;</pre>
<p>Now say you main panel is a grid, put a <code>Border </code>control on it as follows :</p>
<pre>&lt;Border Opacity=<span class="string">"0.9"</span> . . .&gt;
      &lt;Border.Background&gt;
          . . .
      &lt;/Border.Background&gt;
&lt;/Border&gt; </pre>
<p>Set the border&#8217;s background to what you originally wanted the main window&#8217;s background to be. Now you&#8217;ll find a transparent window background where your editable controls can still retain 100% opacity.</p>
<p><strong>Warning </strong>: Setting <code>AllowTransparency </code>to <code>true </code>on the main window potentially results in some very bad performance issues on both XP and Vista since WPF switches to software rendering (in my experience, even with good video cards). Once that happens, animations and video can get pretty unusably slow.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=174</wfw:commentRss>
		</item>
		<item>
		<title>C++/CLI Article : Deriving from a C# disposable class</title>
		<link>http://blog.voidnish.com/?p=173</link>
		<comments>http://blog.voidnish.com/?p=173#comments</comments>
		<pubDate>Sat, 05 Jul 2008 17:24:47 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[C++/CLI]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=173</guid>
		<description><![CDATA[Last week at work, I had to work on a C++/CLI class that derived from a class written in C# which implemented IDisposable. I got it wrong at first (yeah, same guy who wrote a book on the subject a couple of years ago) and my boss and I spent some time going through the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week at work, I had to work on a C++/CLI class that derived from a class written in C# which implemented <code>IDisposable</code>. I got it wrong at first (yeah, same guy who wrote a book on the subject a couple of years ago) and my boss and I spent some time going through the generated code in Reflector before fixing it up. I came home that night and quickly put together a simple project so I could see the whole picture from a simple perspective. I thought it would benefit others to put together an article reflecting (no pun intended) the issue.</p>
<ul>
<li><a href="http://www.voidnish.com/Articles/ShowArticle.aspx?code=CppDerivingDispose">C++/CLI HowTo : Deriving from a C# disposable class</a></li>
<li><a href="http://www.codeproject.com/KB/mcpp/CppDerivingDispose.aspx" target="_blank">Article mirror on The Code Project</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=173</wfw:commentRss>
		</item>
		<item>
		<title>Invoking a virtual method in a managed constructor</title>
		<link>http://blog.voidnish.com/?p=172</link>
		<comments>http://blog.voidnish.com/?p=172#comments</comments>
		<pubDate>Thu, 19 Jun 2008 03:02:27 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[C++/CLI]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=172</guid>
		<description><![CDATA[In standard C++, we know that a virtual method call in a base class constructor will not invoke the derived class override.  This is an area where C++/CLI behaves differently from standard C++. The vtables are initialized even before the base class constructor is called. There was a post in the MSDN forums earlier [...]]]></description>
			<content:encoded><![CDATA[<p>In standard C++, we know that a virtual method call in a base class constructor will not invoke the derived class override.  This is an area where C++/CLI behaves differently from standard C++. The vtables are initialized even before the base class constructor is called. There was a post in the MSDN forums earlier today where someone asked a question related to this and I thought I&#8217;d blog about it.  Take a look at the following code snippet :</p>
<pre>  <span class="keyword">ref</span> <span class="keyword">class</span> ManA
  {
  <span class="keyword">protected</span>:
    NatA* _natA;

    <span class="keyword">virtual</span> <span class="keyword">void</span> Init()
    {
      _natA = <span class="keyword">new</span> NatA();
    }

  <span class="keyword">public</span>:
    ManA()
    {
      Init();
    }
  };

  <span class="keyword">ref</span> <span class="keyword">class</span> ManB : ManA
  {
    NatB* GetNatB()
    {
      <span class="keyword">return</span> <span class="keyword">static_cast</span>&lt;NatB*&gt;(_natA);
    }

  <span class="keyword">protected</span>:
    <span class="keyword">virtual</span> <span class="keyword">void</span> Init() <span class="keyword">override</span>
    {
      _natA = <span class="keyword">new</span> NatB();
    }

  <span class="keyword">public</span>:
    ManB()
    {
    }
  };
}
</pre>
<p>Now, if you do a <code>gcnew ManB()</code> you&#8217;ll see that <code>ManB::Init</code> is called first (this is done during the base class ctor) and then <code>ManB</code>&#8217;s constructor is called. Of course this means that you should not access any member in <code>ManB </code>that needs to be created or initialized in the constructor. In fact this is probably not a good practice at all - but the poster asking this question had a special requirement and this was one straightforward way to address his problem. Note that C# users won&#8217;t find this particularly odd because this is just the way C# behaves too. This behavior is dictated by the fact that the CLR works with vtables directly, and both C# and C++/CLI just followed the curriculum.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=172</wfw:commentRss>
		</item>
		<item>
		<title>When the pizza guy called me Neptune</title>
		<link>http://blog.voidnish.com/?p=171</link>
		<comments>http://blog.voidnish.com/?p=171#comments</comments>
		<pubDate>Tue, 17 Jun 2008 00:18:21 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=171</guid>
		<description><![CDATA[Okay I&#8217;ve been called many things in my life, but this was a first for sure. My wife ordered pizza and I went to pick it up on my way home from work. She gave my name as Nish, and she spelled out the first letter as &#8220;N for Neptune&#8221;. I&#8217;ve heard her use &#8220;S [...]]]></description>
			<content:encoded><![CDATA[<p>Okay I&#8217;ve been called many things in my life, but this was a first for sure. My wife ordered pizza and I went to pick it up on my way home from work. She gave my name as Nish, and she spelled out the first letter as &#8220;N for Neptune&#8221;. I&#8217;ve heard her use &#8220;S for Saturn&#8221; too. Though they are both planets from her perspective I usually tell her that for a lot of folks, one of those is a car and the other&#8217;s an odd word they&#8217;ve never heard before. Anyway the guy on the phone wrote it down as Neptune. So when I went to pick it up I was addressed as Neptune, and though I was surprised I just thought I had misheard him. Then I saw my name on the receipt and there it was - &#8220;Neptune&#8221;. I didn&#8217;t bother correcting him of course, instead I put on my best &#8220;Lord of the sea&#8221; look and walked out with a godly swagger.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=171</wfw:commentRss>
		</item>
		<item>
		<title>Article : Using a TypeDescriptionProvider to support dynamic run-time properties</title>
		<link>http://blog.voidnish.com/?p=170</link>
		<comments>http://blog.voidnish.com/?p=170#comments</comments>
		<pubDate>Sat, 14 Jun 2008 17:19:05 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[C#/.NET]]></category>

		<category><![CDATA[CLR/.NET BCL]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=170</guid>
		<description><![CDATA[Recently at work I had to use the TypeDescriptionProvider attribute while prototyping some new features for our product, and I thought it would be a good idea to demonstrate how to use this attribute and its related classes by writing an article.

Using a TypeDescriptionProvider to support dynamic run-time properties

]]></description>
			<content:encoded><![CDATA[<p>Recently at work I had to use the <code>TypeDescriptionProvider</code> attribute while prototyping some new features for our product, and I thought it would be a good idea to demonstrate how to use this attribute and its related classes by writing an article.</p>
<ul>
<li><a href="http://www.voidnish.com/Articles/ShowArticle.aspx?code=UsingTypeDescriptionProvider">Using a TypeDescriptionProvider to support dynamic run-time properties</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=170</wfw:commentRss>
		</item>
		<item>
		<title>Using underscore to prefix private member fields</title>
		<link>http://blog.voidnish.com/?p=169</link>
		<comments>http://blog.voidnish.com/?p=169#comments</comments>
		<pubDate>Fri, 13 Jun 2008 00:14:47 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[C#/.NET]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=169</guid>
		<description><![CDATA[Joe Stagner blogged today about some basic coding guidelines one of which was to avoid using any sort of prefix for member variables (including the underscore). I personally prefer to use the underscore prefix on private member fields and mainly so they would be easily identifiable from local variables. But Joe&#8217;s guidelines suggested a workaround [...]]]></description>
			<content:encoded><![CDATA[<p>Joe Stagner <a href="http://weblogs.asp.net/joestagner/archive/2008/06/12/net-coding-guidelines.aspx" target="_blank">blogged today</a> about some basic coding guidelines one of which was to avoid using any sort of prefix for member variables (including the underscore). I personally prefer to use the underscore prefix on <code>private</code> member fields and mainly so they would be easily identifiable from local variables. But Joe&#8217;s guidelines suggested a workaround recommending that we use <code>this </code>to indicate a member variable. </p>
<pre>
<span class="keyword">private</span> <span class="keyword">int</span> _age;

<span class="keyword">void</span> Foo()
{
    <span class="keyword">int</span> age;
    <span class="comment">//...</span>
    <span class="keyword">if</span>(age &gt; _age) <span class="comment">// &lt;-- My way</span>
    {
        <span class="comment">//...</span>
    }
}
</pre>
<pre>
<span class="keyword">private</span> <span class="keyword">int</span> age;

<span class="keyword">void</span> Foo()
{
    <span class="keyword">int</span> age;
    <span class="comment">//...</span>
    <span class="keyword">if</span>(age &gt; <span class="keyword">this</span>.age) <span class="comment">// &lt;-- Joe's recommendation</span>
    {
        <span class="comment">//...</span>
    }
}
</pre>
<p>While I did think that was a fair approach, I am still not convinced it&#8217;s fully alright since the onus is on the coder to remember to do this - there&#8217;s nothing stopping him from forgetting to prefix <code>this </code>for member fields. So for the time being I am going to continue using underscore for private members.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=169</wfw:commentRss>
		</item>
		<item>
		<title>Nishant is spelt with a t at the end</title>
		<link>http://blog.voidnish.com/?p=166</link>
		<comments>http://blog.voidnish.com/?p=166#comments</comments>
		<pubDate>Sun, 08 Jun 2008 00:59:03 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=166</guid>
		<description><![CDATA[I am a bit fixated on how people spell my name - for those of you who don’t know, it’s &#8220;Nishant&#8221; - 7 unrepeated letters that even a 4-year old should find it trivial to remember. Unfortunately enough, many Indian names that end in &#8220;nt&#8221; are sometimes pronounced and spelled as &#8220;nth&#8221;, so there’s a [...]]]></description>
			<content:encoded><![CDATA[<p>I am a bit fixated on how people spell my name - for those of you who don’t know, it’s &#8220;Nishant&#8221; - 7 unrepeated letters that even a 4-year old should find it trivial to remember. Unfortunately enough, many Indian names that end in &#8220;nt&#8221; are sometimes pronounced and spelled as &#8220;nth&#8221;, so there’s a common misspelling of my name where there’s an &#8220;h&#8221; suffixed to the &#8220;ant&#8221;. Westerners never spell my name wrong, they always get it right. It’s the Indian folks who sometimes think they know what’s best and misspell my name with the trailing &#8220;h&#8221;. And sometimes it happens on my own blog. People address me using the misspelling when leaving a comment or sending me an email, and when you consider that a majority of these communications are requests for help, you’d think they’d have the basic courtesy to at least get my name correct. Oh well, at least nobody’s misspelled &#8220;Nish&#8221; so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=166</wfw:commentRss>
		</item>
		<item>
		<title>Adding a DockStyle.Fill control at run-time</title>
		<link>http://blog.voidnish.com/?p=165</link>
		<comments>http://blog.voidnish.com/?p=165#comments</comments>
		<pubDate>Sat, 07 Jun 2008 00:45:30 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[CLR/.NET BCL]]></category>

		<category><![CDATA[Windows Forms]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=165</guid>
		<description><![CDATA[This one was simple to resolve but it did halt my progress for about 5-6 minutes recently. I had a form (actually a user control) that had a control on it added at design time docked to the right. During run time I was adding a new WinForms control that I had set to DockStyle.Fill. [...]]]></description>
			<content:encoded><![CDATA[<p>This one was simple to resolve but it did halt my progress for about 5-6 minutes recently. I had a form (actually a user control) that had a control on it added at design time docked to the right. During run time I was adding a new WinForms control that I had set to <code>DockStyle.Fill</code>. Imagine my surprise when the dynamically added control filled the entire user control instead of adhering to the expected docking behavior. Turns out the control that fills the rest of the space always needs to be the first control that&#8217;s on the form or user control. When doing it dynamically, you need to call <code>ControlCollection.SetChildIndex</code>. Here&#8217;s a sample code snippet :</p>
<pre><span class="keyword">private</span> <span class="keyword">void</span> MainForm_Load(<span class="keyword">object</span> sender, EventArgs e)
{
    TextBox textBox = <span class="keyword">new</span> TextBox() { Multiline = <span class="keyword">true</span>, Dock = DockStyle.Fill };
    <span class="keyword">this</span>.Controls.Add(textBox);
    <span class="keyword">this</span>.Controls.SetChildIndex(textBox, <span class="number">0</span>); <span class="comment">// move it to the 0th position</span>
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=165</wfw:commentRss>
		</item>
		<item>
		<title>Article : A look at STL/CLR performance for linear containers</title>
		<link>http://blog.voidnish.com/?p=164</link>
		<comments>http://blog.voidnish.com/?p=164#comments</comments>
		<pubDate>Sat, 08 Mar 2008 13:24:33 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[C++/CLI]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=164</guid>
		<description><![CDATA[This article is an attempt to do a performance comparison of the STL/CLR sequential containers with corresponding generic collections in the BCL. To my total surprise, the STL/CLR containers fell way behind the BCL classes. Talk about misleading expectations.  

A look at STL/CLR performance for linear containers

]]></description>
			<content:encoded><![CDATA[<p>This article is an attempt to do a performance comparison of the STL/CLR sequential containers with corresponding generic collections in the BCL. To my total surprise, the STL/CLR containers fell way behind the BCL classes. Talk about misleading expectations. <img src='http://blog.voidnish.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<ul>
<li><a href="http://www.voidnish.com/Articles/ShowArticle.aspx?code=StlClrBclComparison">A look at STL/CLR performance for linear containers</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=164</wfw:commentRss>
		</item>
		<item>
		<title>A singular solicitor at Target</title>
		<link>http://blog.voidnish.com/?p=163</link>
		<comments>http://blog.voidnish.com/?p=163#comments</comments>
		<pubDate>Tue, 12 Feb 2008 15:45:34 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=163</guid>
		<description><![CDATA[Smitha and I were shopping at Target this past weekend, and as is the norm these days I was pushing little Rohan around in his stroller while Smitha went through the aisles picking, unpicking and then re-picking various items that seized her interest. I was mostly bored and lost in my thoughts when I was [...]]]></description>
			<content:encoded><![CDATA[<p>Smitha and I were shopping at Target this past weekend, and as is the norm these days I was pushing little Rohan around in his stroller while Smitha went through the aisles picking, unpicking and then re-picking various items that seized her interest. I was mostly bored and lost in my thoughts when I was brusquely interrupted by an unwarrantedly loud &#8220;Are you from India?&#8221; from a formally dressed middle-aged Indian gentleman.  I nodded my head in affirmation as curiously enough I did happen to be from India, though for the life of me I cannot figure out what gave that away!</p>
<p>The next few minutes he proceeded to converse with me about how lots of Indians were in the US these days on H1 Visas, how a lot of them went on to get Green Cards, how he recently moved to Atlanta from Arkansas, how he&#8217;d be delighted to introduce his wife to me (apparently she was elsewhere in the store at that time) and a few other topics that I don&#8217;t remember right now. All I remember thinking was how to get out of this conversation, especially since I had a sneaking suspicion that this guy was trying to sell some Amway like pyramid scheme on me. Fortunately Smitha called for me at that moment and I used this opportunity to say goodbye to him, but before I could do so he handed me his business card and asked me for mine. I did not have one with me and when I said that to him, he quickly produced a piece of paper and a pen out of nowhere - honestly, I didn&#8217;t see where he took it out from, he was like a conjurer - conjuring pen and paper out of thin air.  With heavy misgivings I wrote my first name and phone number on his magically produced piece of paper and gave it to him and we parted.</p>
<p>Needless to say, Smitha gave me a quick firing-down for giving my number to a stranger, but fortunately enough she was soon distracted by a shelf containing the oddest looking ladies&#8217; purses I have seen in a while.  Normally this would have worried me since I definitely didn&#8217;t want her carrying around one of those revoltingly unattractive purses, but at that point I was just relieved to get out of her firing line. Just then I noticed a middle aged Indian woman conversing with a young, pretty and trendily dressed Indian girl (looked like she was in her early 20s). Now I don&#8217;t want to come across as someone who eavesdrops when 2 strange women are conversing in front of me, but I couldn&#8217;t help catch a few odd words here and there. It didn&#8217;t take me too long to realize that this woman was basically dishing out the same stuff to this girl that the strange guy had earlier dished out to me, and in a minute or so I saw the hapless girl hand over her phone numbers to this lady (I distinctly remember her explicitly specifying her land, work and cell numbers). I was certain that this middle aged lady was the earlier gentleman&#8217;s spouse and at that point it became increasingly evident that they were soliciting phone numbers from Indian looking folks.</p>
<p>My suspicions were confirmed a little later when we left Target with Smitha&#8217;s shopping picks for the day. The middle aged couple were walking together towards the parking lot, and most markedly they did not have a single item with them (forget a bag). They had basically spent close to an hour inside Target seeking out potential Indian victims (who they hoped would be new enough to the country) and collecting their information. I fully expect to receive a phone call this week inviting me to a gathering of some sort where this gathering would most definitely be a sales talk for some crappy pyramid scheme. Obviously I would get out of it with a clever excuse but I really do feel sorry for the pretty young girl who did seem naïve enough to fall into this trap. Oh well, I suppose she will eventually learn that strange Indian looking people approaching  you in the middle of a store and asking you if you are from India are to be treated with the deepest mistrust and skepticism possible. Oh, and we are going to Target this evening - Smitha wants to return a hand bag that she took half an hour to select, apparently she did not like it when she looked at it this morning and so wants a new one. Sigh!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=163</wfw:commentRss>
		</item>
		<item>
		<title>Please wait as I have to reboot my PC!</title>
		<link>http://blog.voidnish.com/?p=162</link>
		<comments>http://blog.voidnish.com/?p=162#comments</comments>
		<pubDate>Sat, 26 Jan 2008 14:19:19 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=162</guid>
		<description><![CDATA[I&#8217;ve had some very interesting experiences when calling customer support, but last week a call to Comcast resulted in a whole new experience for me. After being on hold for about 5 minutes, listening to some of the most awful music you could possibly round up, a girl picks up. She greets me and then [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had some very interesting experiences when calling customer support, but last week a call to Comcast resulted in a whole new experience for me. After being on hold for about 5 minutes, listening to some of the most awful music you could possibly round up, a girl picks up. She greets me and then tells me apologetically (I hope) that her PC has got very slow and so she&#8217;s going to reboot it and will I please wait? For a profound few seconds, I stood there in incredulous shock. Though to be fair to her, she did come back after 3-4 minutes (pretty slow machine if it takes that long to boot) and she did help me out, and I somehow managed to resist making some weird joke asking her if she&#8217;d mind if I rebooted my PC as mine was getting a little slow too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=162</wfw:commentRss>
		</item>
		<item>
		<title>Article : Deploying MFC applications via ClickOnce</title>
		<link>http://blog.voidnish.com/?p=161</link>
		<comments>http://blog.voidnish.com/?p=161#comments</comments>
		<pubDate>Sun, 13 Jan 2008 17:26:07 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<category><![CDATA[CLR/.NET BCL]]></category>

		<category><![CDATA[Win32/MFC]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=161</guid>
		<description><![CDATA[Recently I had the task of deploying an MFC application suite along with its dependencies via ClickOnce. Visual Studio does not directly support deployment of MFC applications (even if it&#8217;s compiled with /clr) and one of the suggested solutions I found on the web was to have a stub C# executable which would launch the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had the task of deploying an MFC application suite along with its dependencies via ClickOnce. Visual Studio does not directly support deployment of MFC applications (even if it&#8217;s compiled with /clr) and one of the suggested solutions I found on the web was to have a stub C# executable which would launch the main MFC application. That way you could take advantage of Visual Studio&#8217;s built-in deployment functionality. My friend <a href="http://weblogs.asp.net/ramakrishna/default.aspx">Rama Vavilala </a>had a better suggestion for me - he asked me to try putting in a dummy cpp file into the main project that was compiled using /clr. If ClickOnce accepted such an executable as a .NET assembly, then all I would have to do would be to create the required manifest files on my own. Well all I can say is hats off to Rama for his elegant solution - because it actually did work. This article is a step-by-step pictorial on how you would deploy an MFC application using this trick.</p>
<ul>
<li><a href="http://www.voidnish.com/Articles/ShowArticle.aspx?code=MfcClickOnce">Deploying MFC applications via ClickOnce</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=161</wfw:commentRss>
		</item>
		<item>
		<title>Really getting design patterns</title>
		<link>http://blog.voidnish.com/?p=160</link>
		<comments>http://blog.voidnish.com/?p=160#comments</comments>
		<pubDate>Thu, 03 Jan 2008 01:35:29 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=160</guid>
		<description><![CDATA[The CEO of my first company (who was an old time assembler/C programmer even before I was born) liked to periodically quote, &#8220;you either get pointers or you don&#8217;t&#8221;. I believe I&#8217;ve seen variants of that on the web - but I just did some Googling and could not find out who made the original [...]]]></description>
			<content:encoded><![CDATA[<p>The CEO of my first company (who was an old time assembler/C programmer even before I was born) liked to periodically quote, &#8220;you either get pointers or you don&#8217;t&#8221;. I believe I&#8217;ve seen variants of that on the web - but I just did some Googling and could not find out who made the original quote (if there&#8217;s indeed someone who this is attributed to). Anyway I am not really talking about pointers here - I am talking about design patterns. The first time I read the GOF&#8217;s Design Patterns, I remember thinking that some of those patterns did look familiar and that I&#8217;ve used them without knowing what they were formally called. But I also remember thinking that some of the structural and behavioral patterns described in the book didn&#8217;t seem particularly useful - in fact I thought that it was just a big pile of complicated sounding text. But since the rest of the smart programming world accepted these patterns I remember worriedly pondering over whether I was one of those unfortunates who simply didn&#8217;t &#8220;get&#8221; design patterns.</p>
<p>Anyway I have re-read the book a few times now, some parts of it several times, some parts of it maybe a couple of times, and with each iteration I ended up with a &#8220;hey that makes sense now&#8221; feeling. I spent the last few days of this Christmas/New Year holiday re-reading the entire book and this was probably my best experience so far. I instinctively recognized familiar patterns that I had seen in use in MFC and the .NET class library, and I also began to understand certain patterns better (even those that I was previously sure I understood). I don&#8217;t think I&#8217;ve fully got it even now, but I have concluded that the key to getting design patterns is probably to apply them in many different scenarios and perhaps occasionally coming back to the book and giving it a quick read (1-2 hours should be good enough to scan the entire book and refresh your memory). And though design patterns is a subject that has been covered once too often in various blogs and articles I may occasionally blog about my attempts at applying known patterns to specific problems. That I guess would be my new year resolution (or at least one of a dozen others).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=160</wfw:commentRss>
		</item>
		<item>
		<title>Typed URLs Cleaner utility for Windows Vista</title>
		<link>http://blog.voidnish.com/?p=159</link>
		<comments>http://blog.voidnish.com/?p=159#comments</comments>
		<pubDate>Mon, 31 Dec 2007 17:22:49 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[CLR/.NET BCL]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=159</guid>
		<description><![CDATA[One really annoying feature in Windows Vista is that the typed URL history is shared between Windows Explorer and IE. So when you are using your browser and you drop down the address bar, you end up seeing dozens of local folders or network paths when all you really want to see are the web [...]]]></description>
			<content:encoded><![CDATA[<p>One really annoying feature in Windows Vista is that the typed URL history is shared between Windows Explorer and IE. So when you are using your browser and you drop down the address bar, you end up seeing dozens of local folders or network paths when all you really want to see are the web URLs. I did some Googling and concluded that there&#8217;s no built in way to disable this &#8220;feature&#8221;. Eventually I ended up writing a simple app that has a timer and periodically checks the registry key where typed URLs are stored and removes all those entries that do not start with &#8220;http://&#8221; or &#8220;https://&#8221;.</p>
<p><img src="http://www.voidnish.com/Articles/TypedUrlsCleaner/Capture.JPG" alt="Screenshot" width="375" height="301" /></p>
<ul>
<li><a href="http://www.voidnish.com/Articles/TypedUrlsCleaner/TypedUrlsCleaner_App.zip">Download the compiled application</a></li>
<li><a href="http://www.voidnish.com/Articles/TypedUrlsCleaner/TypedUrlsCleaner_Src.zip">Download the application source code</a></li>
<li><a href="http://www.voidnish.com/Articles/ShowArticle.aspx?code=TypedUrlsCleaner">See the application related article on my website</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=159</wfw:commentRss>
		</item>
		<item>
		<title>Article : Using data selectors to create a listbox with expand/collapse support</title>
		<link>http://blog.voidnish.com/?p=157</link>
		<comments>http://blog.voidnish.com/?p=157#comments</comments>
		<pubDate>Thu, 27 Dec 2007 19:29:45 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[Avalon]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=157</guid>
		<description><![CDATA[After a brief gap I have decided to get back to writing articles. The following article demonstrates how to use data template selectors and also how to create a hierarchical listbox with expand/collapse support :-

Using data selectors to create a listbox with expand/collapse support

]]></description>
			<content:encoded><![CDATA[<p>After a brief gap I have decided to get back to writing articles. The following article demonstrates how to use data template selectors and also how to create a hierarchical listbox with expand/collapse support :-</p>
<ul>
<li><a href="http://voidnish.com/Articles/ShowArticle.aspx?code=WpfTemplateSelector">Using data selectors to create a listbox with expand/collapse support</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=157</wfw:commentRss>
		</item>
		<item>
		<title>WPF tip : Using a custom title bar</title>
		<link>http://blog.voidnish.com/?p=156</link>
		<comments>http://blog.voidnish.com/?p=156#comments</comments>
		<pubDate>Sat, 27 Oct 2007 14:08:05 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[Avalon]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=156</guid>
		<description><![CDATA[While you can always custom paint the windows title bar, in most cases it ends up being a very messy approach with possible side effects. What I do in WPF is to disable the title bar in the window by setting its WindowStyle to none.
&#60;Window x:Class="..."
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  [...]]]></description>
			<content:encoded><![CDATA[<p>While you can always custom paint the windows title bar, in most cases it ends up being a very messy approach with possible side effects. What I do in WPF is to disable the title bar in the window by setting its <code>WindowStyle </code>to <code>none</code>.</p>
<pre><span class="keyword">&lt;</span>Window x:Class<span class="keyword">=</span><span class="string">"..."</span>
    <span class="keyword">xmlns</span><span class="keyword">=</span><span class="string">"http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span>
    <span class="keyword">xmlns</span>:x<span class="keyword">=</span><span class="string">"http://schemas.microsoft.com/winfx/2006/xaml"</span>
    ...
    MinWidt<span class="keyword">h=</span><span class="string">"700"</span> WindowStyle<span class="keyword">=</span><span class="string">"None"</span> Ico<span class="keyword">n=</span><span class="string">"..."</span><span class="keyword">&gt;</span></pre>
<p>I then define a user control that will act as the title bar and place it on top of the window. Adding maximize/restore, minimize, and close buttons is not a biggie. You just need to remember to toggle the maximize button with restore (to match normal windows behavior). All you need to do is to set <code>WindowState </code>to <code>WindowState.Minimized</code>, <code>WindowState.Normal</code>, or <code>WindowState.Maximized </code>as required. You might also want to handle double-click and route it to the maximize/restore handler (again to match windows behavior). The one final step would be to handle title bar based drag. To do that, handle the <code>MouseDown </code>event and do this :-</p>
<pre><span class="keyword">void</span> TitleBar_MouseDown(<span class="keyword">object</span> sender, MouseButtonEventArgs e)
{
    <span class="keyword">if</span>(e.ChangedButton == MouseButton.Left)
        Application.Current.MainWindow.DragMove();
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=156</wfw:commentRss>
		</item>
		<item>
		<title>Creating an unmovable dialog</title>
		<link>http://blog.voidnish.com/?p=155</link>
		<comments>http://blog.voidnish.com/?p=155#comments</comments>
		<pubDate>Tue, 04 Sep 2007 12:49:20 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[Win32/MFC]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=155</guid>
		<description><![CDATA[Someone recently asked in the MSDN forums how to create an unmovable dialog using MFC. The simplest way to do this is to remove SC_MOVE from the dialog&#8217;s system menu. This can be easily done in OnInitDialog :-
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
    pSysMenu->RemoveMenu(SC_MOVE, MF_BYCOMMAND);
}
Obviously, you need to think of why [...]]]></description>
			<content:encoded><![CDATA[<p>Someone recently asked in the MSDN forums how to create an unmovable dialog using MFC. The simplest way to do this is to remove <code>SC_MOVE</code> from the dialog&#8217;s system menu. This can be easily done in <code>OnInitDialog </code>:-</p>
<pre>CMenu* pSysMenu = GetSystemMenu(FALSE);
<span class="keyword">if</span> (pSysMenu != <span class="keyword">NULL</span>)
{
    pSysMenu->RemoveMenu(SC_MOVE, MF_BYCOMMAND);
}</pre>
<p>Obviously, you need to think of why you&#8217;d want to do soemthing like this. I personally would find it very annoying if some app I installed prevented me from moving its main dialog. Though perhaps it would be okay if there was a way to minimize the app. An alternate way would be to prevent the dialog from moving via the mouse, but to still enable keyboard-based moving. To do that, we handle <code>WM_NCHITTEST</code> and do something like this :-</p>
<pre>LRESULT CUnmovableDlg::OnNcHitTest(CPoint point)
{
    LRESULT result = CDialog::OnNcHitTest(point);
    <span class="keyword">return</span> result == HTCAPTION ? HTCLIENT : result;
}</pre>
<p>We treat <code>HTCAPTION </code>like <code>HTCLIENT</code>, so now the user cannot drag/move using the title bar. He can still move it via the keyboard (assuming you have not removed <code>SC_MOVE</code>). Once again, unless you have a very good reason, this is not something I would recommend at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=155</wfw:commentRss>
		</item>
		<item>
		<title>A generic function to find a visual child from a visual tree</title>
		<link>http://blog.voidnish.com/?p=154</link>
		<comments>http://blog.voidnish.com/?p=154#comments</comments>
		<pubDate>Tue, 07 Aug 2007 12:22:29 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[Avalon]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=154</guid>
		<description><![CDATA[Here&#8217;s a simple function you can use to get a specific child from a given visual tree. For example, you may want to get a handle to the scrollviewer in a listbox control. Here&#8217;s how you&#8217;d use the function to do that :-
ScrollViewer scrollViewer = FindChildControl&#60;ScrollViewer&#62;(searchResultsListbox);
And here&#8217;s the function listing :-
private T FindChildControl&#60;T&#62;(DependencyObject outerDepObj) where [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simple function you can use to get a specific child from a given visual tree. For example, you may want to get a handle to the scrollviewer in a listbox control. Here&#8217;s how you&#8217;d use the function to do that :-</p>
<pre>ScrollViewer scrollViewer = FindChildControl&lt;ScrollViewer&gt;(searchResultsListbox);</pre>
<p>And here&#8217;s the function listing :-</p>
<pre><span class="keyword">private</span> T FindChildControl&lt;T&gt;(DependencyObject outerDepObj) <span class="keyword">where</span> T:DependencyObject
{
    T child = <span class="keyword">null</span>;

    <span class="keyword">for</span> (<span class="keyword">int</span> index = <span class="number">0</span>; index &lt; VisualTreeHelper.GetChildrenCount(outerDepObj); index++)
    {
        DependencyObject depObj = VisualTreeHelper.GetChild(outerDepObj, index);

        <span class="keyword">if</span> (depObj <span class="keyword">is</span> T)
        {
            child = depObj <span class="keyword">as</span> T;
        }
        <span class="keyword">else</span> <span class="keyword">if</span> (VisualTreeHelper.GetChildrenCount(depObj) &gt; <span class="number">0</span>)
        {
            child = FindChildControl&lt;T&gt;(depObj);
        }

        <span class="keyword">if</span> (child != <span class="keyword">null</span>)
        {
            <span class="keyword">break</span>;
        }
    }

    <span class="keyword">return</span> child;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=154</wfw:commentRss>
		</item>
		<item>
		<title>Setting FontSize programmatically</title>
		<link>http://blog.voidnish.com/?p=153</link>
		<comments>http://blog.voidnish.com/?p=153#comments</comments>
		<pubDate>Sun, 29 Jul 2007 12:56:08 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[Avalon]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=153</guid>
		<description><![CDATA[I was moving a WinForms app to WPF and I was perplexed for quite a while this morning when I found that setting the FontSize on a WPF TextBlock didn&#8217;t really give me the font-size I expected (the one that WinForms gave me). It was obvious pretty soon that WinForms was using point as the [...]]]></description>
			<content:encoded><![CDATA[<p>I was moving a WinForms app to WPF and I was perplexed for quite a while this morning when I found that setting the <code>FontSize </code>on a WPF <code>TextBlock </code>didn&#8217;t really give me the font-size I expected (the one that WinForms gave me). It was obvious pretty soon that WinForms was using point as the unit while the WPF default was to use device independent pixels. For a while I was confused as to how to set the font-size in points programmatically, since the <code>FontSize </code>setter only took a <code>double </code>and thus I couldn&#8217;t pass a unit-specific string as I could in Xaml. The solution was simple and it beats me why I didn&#8217;t think of it sooner, but for those others who occasionally hit dense brain periods like I do, the trick is to use <code>FontSizeConverter</code>.</p>
<pre><span class="keyword">double</span> pointSize = (<span class="keyword">double</span>)<span class="keyword">new</span> FontSizeConverter().ConvertFrom(<span class="string">"8pt"</span>);</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=153</wfw:commentRss>
		</item>
		<item>
		<title>A data-bound multi-column combobox</title>
		<link>http://blog.voidnish.com/?p=152</link>
		<comments>http://blog.voidnish.com/?p=152#comments</comments>
		<pubDate>Sat, 28 Jul 2007 12:05:47 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
		
		<category><![CDATA[CLR/.NET BCL]]></category>

		<guid isPermaLink="false">http://blog.voidnish.com/?p=152</guid>
		<description><![CDATA[I wrote a multi-column combobox class with support for data-binding at work and I have published an article on it here :-

A data-bound multi-column combobox

It&#8217;s fairly easy to use and all you need to do is to set the DataSource property. The control will auto-populate the columns from the columns (if any) in the DataSource.
]]></description>
			<content:encoded><![CDATA[<p>I wrote a multi-column combobox class with support for data-binding at work and I have published an article on it here :-</p>
<ul>
<li><a href="http://www.voidnish.com/Articles/ShowArticle.aspx?code=DotNetMultiColumnComboBox">A data-bound multi-column combobox</a></li>
</ul>
<p>It&#8217;s fairly easy to use and all you need to do is to set the <code>DataSource </code>property. The control will auto-populate the columns from the columns (if any) in the <code>DataSource</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.voidnish.com/?feed=rss2&amp;p=152</wfw:commentRss>
		</item>
	</channel>
</rss>
