<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" 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/"><channel><title>What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx</link><description>The other day, I wrote about measuring the dimensions of a piece of text using the DrawText API . My code worked just great when I initially tested it (obviously it’s a part of a larger chunk of code that does more complicated work).&amp;#160; The problem</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8839299</link><pubDate>Thu, 07 Aug 2008 01:43:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8839299</guid><dc:creator>Larry Osterman [MSFT]</dc:creator><description>&lt;p&gt;Sys64738: Two words: &amp;quot;Managed Code&amp;quot;. &amp;nbsp;There are severe architectural layering issues with using extremely high level components like WPF. &amp;nbsp;Server administrators will get hideously upset if they had to get WPF on their server machines just because the volume control UI used it.&lt;/p&gt;
&lt;p&gt;The CLR team is improving things regularly and there is more and more managed code in Windows but the vast majority of Windows code is unmanaged.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8839299" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8839259</link><pubDate>Thu, 07 Aug 2008 01:23:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8839259</guid><dc:creator>Sys64738</dc:creator><description>&lt;p&gt;Hi Larry,&lt;/p&gt;
&lt;p&gt;why don't you use a WPF-like technology in Windows UI? &lt;/p&gt;
&lt;p&gt;I think that WPF is based on Direct3D (which is a native technology), with an interface layer to export native D3D stuff to managed world (maybe you use C++/CLI ?). So I wonder: what about using some kind of &amp;quot;WPF&amp;quot; in a 100% native context i.e. Direct3D *hardware accelerated rendering* using a *declarative* approach (like WPF does) for Windows UI?&lt;/p&gt;
&lt;p&gt;...Performance reasons?&lt;/p&gt;
&lt;p&gt;BTW: Thank you for your interesting blog posts! (Especially this &amp;quot;What's wrong in code&amp;quot; series - they help us learning a lot).&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8839259" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8834198</link><pubDate>Tue, 05 Aug 2008 18:05:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8834198</guid><dc:creator>Larry Osterman [MSFT]</dc:creator><description>&lt;p&gt;Ben: Raymond Chen just sent me an email suggesting the same thing. &amp;nbsp;I hadn't realized that DT_CALCRECT would suppress drawing.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8834198" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8834070</link><pubDate>Tue, 05 Aug 2008 17:05:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8834070</guid><dc:creator>anony.muos</dc:creator><description>&lt;p&gt;Hey Larry,&lt;/p&gt;
&lt;p&gt;This is unrelated but please answer this. What ASUS seem have done is they've implemented DS3D in software as part of their Xonar drivers and MS's latest effort XAudio 2 also is a software-based DSP/surround sound solution however it's RTM in March isn't well publicized by MS, as a result, very few developers are aware of it or use it. My question is technically, would it have been possible for Microsoft to implement DS3D in software so that all the surround effects would have worked? If so, if there were time constraints with Windows Vista, why can't the same be achieved with Windows 7? Or is it not technically possible with the new audio stack?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8834070" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8833950</link><pubDate>Tue, 05 Aug 2008 16:01:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8833950</guid><dc:creator>Dave</dc:creator><description>&lt;p&gt;Isn't quite a bit of the non-trivial UI done in HTML, via embedded WebBrowser controls? I know the XP Help and Support Center does that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8833950" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8833791</link><pubDate>Tue, 05 Aug 2008 14:29:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8833791</guid><dc:creator>Pascal</dc:creator><description>&lt;p&gt;Hi Larry, &lt;/p&gt;
&lt;p&gt;Is there a good reason to initialize rcText this way ?&lt;/p&gt;
&lt;p&gt;RECT rcText = {0, 0, 88, 34}; &lt;/p&gt;
&lt;p&gt;Thanks for this interesting post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8833791" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8833202</link><pubDate>Tue, 05 Aug 2008 09:17:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8833202</guid><dc:creator>Larry Osterman [MSFT]</dc:creator><description>&lt;p&gt;&amp;quot;me&amp;quot;: You're wrong. &amp;nbsp;I have no idea where you work, but in my division we absolutely do NOT use WPF. &amp;nbsp;The same is true for almost all of the Windows division.&lt;/p&gt;
&lt;p&gt;For various reasons the volume control UI doesn't use one of the internal frameworks (unless you count ATL as an &amp;quot;internal framework&amp;quot;). &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8833202" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8833029</link><pubDate>Tue, 05 Aug 2008 07:55:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8833029</guid><dc:creator>me</dc:creator><description>&lt;p&gt;Technically speaking, if you're writing UI inside of MS, you should not use GDI. WPF would be good, and if that's no option, one of the internal frameworks. Same applies on the outside&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8833029" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8832781</link><pubDate>Tue, 05 Aug 2008 05:56:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8832781</guid><dc:creator>Miral</dc:creator><description>&lt;p&gt;@TimHollebeek: the &amp;quot;extra state&amp;quot; *is* already split out and passed as a separate parameter. &amp;nbsp;It's the HDC parameter.&lt;/p&gt;
&lt;p&gt;(And as for saving old state, you can use SaveDC/RestoreDC for that purpose.)&lt;/p&gt;
&lt;p&gt;@Ben: Using GetDC won't necessarily work. &amp;nbsp;That returns a DC compatible with the window and clipped to its bounds, but not necessarily with the control's font / colour scheme selected. &amp;nbsp;(If it's using a custom font, then it'll almost certainly *not* be selected.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8832781" width="1" height="1"&gt;</description></item><item><title>re: What’s wrong with this code, Part 22 – the answers</title><link>http://blogs.msdn.com/b/larryosterman/archive/2008/08/04/what-s-wrong-with-this-code-part-22-the-answers.aspx#8832643</link><pubDate>Tue, 05 Aug 2008 04:22:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8832643</guid><dc:creator>Billy</dc:creator><description>&lt;p&gt;Don't forget to test with ClearType on and off as well. &amp;nbsp;ClearType can have subtle effects on your font sizes as well, though they appear to affect GDI+/managed drawing more than straight GDI.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8832643" width="1" height="1"&gt;</description></item></channel></rss>