<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dev. &#187; win32</title>
	<atom:link href="http://coliena.com/blog/tag/win32/feed/" rel="self" type="application/rss+xml" />
	<link>http://coliena.com/blog</link>
	<description>some software engineers&#039; random rants and thoughts</description>
	<lastBuildDate>Mon, 30 Aug 2010 20:02:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fighting Windows Sockets Legacy Troubles</title>
		<link>http://coliena.com/blog/2010/05/winsock-troubles/</link>
		<comments>http://coliena.com/blog/2010/05/winsock-troubles/#comments</comments>
		<pubDate>Fri, 14 May 2010 19:00:31 +0000</pubDate>
		<dc:creator>niels</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://coliena.com/blog/?p=290</guid>
		<description><![CDATA[I came across a really annoying problem while using win32 sockets one of my bigger projects. In short, the VisualC compiler complained about redefinitions of basic Windows socket macros: C:\sdk\windows\v6.0a\include\ws2def.h&#40;91&#41; : warning C4005: 'AF_IPX' : macro redefinition C:\sdk\windows\v6.0a\include\winsock.h&#40;460&#41; : see previous definition of 'AF_IPX' C:\sdk\windows\v6.0a\include\ws2def.h&#40;124&#41; : warning C4005: 'AF_MAX' : macro redefinition C:\sdk\windows\v6.0a\include\winsock.h&#40;479&#41; : see [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a really annoying problem while using win32 sockets one of my bigger projects. In short, the VisualC compiler complained about redefinitions of basic Windows socket macros:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">91</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> warning C4005<span style="color: #339933;">:</span> <span style="color: #ff0000;">'AF_IPX'</span> <span style="color: #339933;">:</span> macro redefinition
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\winsock.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">460</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> see previous definition of <span style="color: #ff0000;">'AF_IPX'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">124</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> warning C4005<span style="color: #339933;">:</span> <span style="color: #ff0000;">'AF_MAX'</span> <span style="color: #339933;">:</span> macro redefinition
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\winsock.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">479</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> see previous definition of <span style="color: #ff0000;">'AF_MAX'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">163</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> warning C4005<span style="color: #339933;">:</span> <span style="color: #ff0000;">'SO_DONTLINGER'</span> <span style="color: #339933;">:</span> macro redefinition
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\winsock.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">402</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> see previous definition of <span style="color: #ff0000;">'SO_DONTLINGER'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">206</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> error C2011<span style="color: #339933;">:</span> <span style="color: #ff0000;">'sockaddr'</span> <span style="color: #339933;">:</span> <span style="color: #ff0000;">'struct'</span> type redefinition
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\winsock.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">485</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> see declaration of <span style="color: #ff0000;">'sockaddr'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">384</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> error C2143<span style="color: #339933;">:</span> syntax error <span style="color: #339933;">:</span> missing <span style="color: #ff0000;">'}'</span> before <span style="color: #ff0000;">'constant'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">384</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> error C2143<span style="color: #339933;">:</span> syntax error <span style="color: #339933;">:</span> missing <span style="color: #ff0000;">';'</span> before <span style="color: #ff0000;">'constant'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">384</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> error C2059<span style="color: #339933;">:</span> syntax error <span style="color: #339933;">:</span> <span style="color: #ff0000;">'constant'</span>
C<span style="color: #339933;">:</span>\sdk\windows\v6.0a\include\ws2def.<span style="color: #202020;">h</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">437</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> error C2143<span style="color: #339933;">:</span> syntax error <span style="color: #339933;">:</span> missing <span style="color: #ff0000;">';'</span> before <span style="color: #ff0000;">'}
(...)</span></pre></div></div>

<p><span id="more-290"></span><br />
After some digging in the code I noticed that <em>windows.h</em> had been included before <em>winsock2.h</em>. And that <em>windows.h</em> includes <em>winsock.h</em>. When digging deeper, I found <a href="http://msdn.microsoft.com/en-us/library/ms738562.aspx">an article in the MSDN</a> describing what had happened here:<br />
actually, this is a legacy problem. In Windows versions <= Windows 98, WinSock 1.1 had been used. The current win32 socket implementation, Windows Sockets 2 (WinSock 2.0), is backwards compatible to Windows Sockets 1.1. Additionally, the <em>winsock2.h</em> header files prevents the inclusion of the legacy <em>winsock.h</em> header file. But once you include <em>winsock.h</em>, you can not include <em>winsock2.h</em> later on.<br />
Unfortunately, <em>windows.h</em> still includes <em>winsock.h</em>.<br />
Fortunately, you can disable the legacy parts of the Windows SDK easily:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#define WIN32_LEAN_AND_MEAN</span></pre></div></div>

<p>You will not be able to build Windows 95/Windows 98 applications when using this definition. But if you were targeting those OS versions, you wouldn&#8217;t be using Windows Sockets 2 anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://coliena.com/blog/2010/05/winsock-troubles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending win32 Messages to Windows Applications</title>
		<link>http://coliena.com/blog/2010/03/sending-win32-messages-to-windows-applications/</link>
		<comments>http://coliena.com/blog/2010/03/sending-win32-messages-to-windows-applications/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 18:43:53 +0000</pubDate>
		<dc:creator>niels</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://coliena.com/blog/?p=253</guid>
		<description><![CDATA[TortoiseSVN itself is a very cool tool. And it&#8217;s developers have created a nice collection of very helpful utilities as well. So, if you ever need to send a single win32 message to a running application, you might try SendMessage. Small size, works as advertised, free.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tortoisesvn.net">TortoiseSVN</a> itself is a very cool tool. And it&#8217;s developers have created a nice collection of very helpful utilities as well.<br />
So, if you ever need to send a single win32 message to a running application, you might try <a href="http://tools.tortoisesvn.net/SendMessage">SendMessage</a>.<br />
Small size, works as advertised, free. <img src='http://coliena.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://coliena.com/blog/2010/03/sending-win32-messages-to-windows-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
