<?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>Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx</link><description>Hello, I’m Pat Brenner, a developer on the Visual C++ Libraries team, and I am the primary developer working on MFC. I’ve realized over the course of the past several years that a number of developers (especially those using ATL and/or MFC) can be confused</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10286959</link><pubDate>Fri, 23 Mar 2012 16:47:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10286959</guid><dc:creator>S. Colcord</dc:creator><description>&lt;p&gt;This recommendation makes sense if a developer&amp;#39;s top priority is to move quickly to take advantage of the latest, greatest, OS APIs, such that they&amp;#39;re willing to expend a fair amount of effort supporting simultaneous old and new API usage within the same product. &amp;nbsp;I can see why it&amp;#39;s in Microsoft&amp;#39;s interests to move people to new APIs ASAP, so I can believe that this is recommended practice for MS teams.&lt;/p&gt;
&lt;p&gt;However, for most development shops, it doesn&amp;#39;t make sense to spend a lot of effort developing features that only customers on recent OS versions can take advantage of. &amp;nbsp;It&amp;#39;s much more cost effective to develop for the lowest common denominator, unless the new APIs offer something incredibly compelling.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10286959" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10286520</link><pubDate>Thu, 22 Mar 2012 18:47:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10286520</guid><dc:creator>Marcello F.</dc:creator><description>&lt;p&gt;BTW, I have found a serious bug in at least one of the collection classes of the MFC that yields wrong results, when building my application with optimizations enabled. This doesn&amp;#39;t happen when I build the app with the optimizations disabled (ie: debug build). I have verified this with MFC 4.2 dynamically linked. I haven&amp;#39;t tested yet what happens when compiled with the latest version of the MFC but I am very concerned.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10286520" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10286186</link><pubDate>Thu, 22 Mar 2012 03:01:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10286186</guid><dc:creator>Marcello F.</dc:creator><description>&lt;p&gt;I have checked the source files in VS2008 and many if not all of the WINVER defines are in the headers files, in structures and inline functions. I wonder how if the MFC is built targeting Windows Server 2003, there wouldn&amp;#39;t be problems when loading the libraries in a different OS ie: Windows XP? Maybe this is another good reason to program in .NET: so we don&amp;#39;t have to worry about these issues? There are not #defines in .NET.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10286186" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10284245</link><pubDate>Fri, 16 Mar 2012 14:33:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10284245</guid><dc:creator>GregM</dc:creator><description>&lt;p&gt;Rob, I know, i&amp;#39;ve found one of those myself. &amp;nbsp;I reported it in connect, and it was fixed in a future version. &amp;nbsp;Do you know if that one has been logged in connect?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10284245" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10284146</link><pubDate>Fri, 16 Mar 2012 10:40:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10284146</guid><dc:creator>RobM</dc:creator><description>&lt;p&gt;GregM: Option a: set the WINVER to the lowest value, and load functions that aren&amp;#39;t available to you using GetProcAddress when the compiler tells you that it isn&amp;#39;t available.&lt;/p&gt;
&lt;p&gt;Warning - not all functions are protected by WINVER #defines. &lt;/p&gt;
&lt;p&gt;StrFormatByteSizeEx is one example of a function which is not protected.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10284146" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10283731</link><pubDate>Thu, 15 Mar 2012 15:42:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10283731</guid><dc:creator>GregM</dc:creator><description>&lt;p&gt;JLO, or even worse, X + 1.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10283731" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10283533</link><pubDate>Thu, 15 Mar 2012 08:49:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10283533</guid><dc:creator>JLO</dc:creator><description>&lt;p&gt;Maybe because of the &amp;quot;best practice&amp;quot; MS platform SDK includes are buggy and some API is marked as available only starting OS X while it is actually available starting OS X minus one.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10283533" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10283420</link><pubDate>Thu, 15 Mar 2012 03:12:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10283420</guid><dc:creator>GregM</dc:creator><description>&lt;p&gt;Option a: set the WINVER to the lowest value, and load functions that aren&amp;#39;t available to you using GetProcAddress when the compiler tells you that it isn&amp;#39;t available.&lt;/p&gt;
&lt;p&gt;Option b: set the WINVER to the highest value, and load functions that aren&amp;#39;t available to you using GetProcAddress when you look up in the documentation and find that it&amp;#39;s not available to you.&lt;/p&gt;
&lt;p&gt;Hrm, which is more error prone? &amp;nbsp;I guess it&amp;#39;s Option b! &amp;nbsp;I&amp;#39;ll stick with Option a thank you.&lt;/p&gt;
&lt;p&gt;Pat, can you explain what automated methods you have for doing Option b that the rest of us obviously don&amp;#39;t know about? &amp;nbsp;I assume that you must have some.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10283420" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10283270</link><pubDate>Wed, 14 Mar 2012 22:23:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10283270</guid><dc:creator>jalf</dc:creator><description>&lt;p&gt;So, a naive question:&lt;/p&gt;
&lt;p&gt;If the &amp;quot;best practice&amp;quot; from Microsoft really is to actively *prevent* the compiler from detecting errors, shouldn&amp;#39;t the compiler team step in and create some more powerful tools? Say, extend the /analyze switch to detect and flag all API calls to functions defined in higher versions of Windows than some specified value, allowing me to flag, for example, all API calls that rely on Vista or newer.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10283270" width="1" height="1"&gt;</description></item><item><title>re: Setting WINVER for MFC Applications</title><link>http://blogs.msdn.com/b/vcblog/archive/2012/03/13/10282397.aspx#10283159</link><pubDate>Wed, 14 Mar 2012 19:42:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10283159</guid><dc:creator>Adrian</dc:creator><description>&lt;p&gt;This certainly wasn&amp;#39;t considered the best practice when I worked at Microsoft. &amp;nbsp;It seems contrary to the immense effort Microsoft has historically put into backward compatibility. &amp;nbsp;We always set the macros to the oldest supported version. &amp;nbsp;Where ever you want to uses a newer API, you called LoadLibrary/GetProcAddress and locally declared any missing structures. &amp;nbsp;That kept the newer structure definitions from leaking back into the general purpose code and ensured nobody ever unknowingly called an unsupported API.&lt;/p&gt;
&lt;p&gt;The best advice along these lines that I&amp;#39;ve ever heard is to develop on the oldest version of the OS you plan to support, and test (primarily) on the most recent. &amp;nbsp;Unless the developers experience the pain points that their users will experience first hand, it&amp;#39;s hard to understand the priorities of fixing these. &amp;nbsp;I used to work on a large team, and we had developers on a wide variety of the supported OSes and hardware. &amp;nbsp;This was a while ago, so we had some developers on Windows 3.1, some on NT4, some on 95, etc. &amp;nbsp;It was great for discovering and debugging platform-specific issues.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10283159" width="1" height="1"&gt;</description></item></channel></rss>