<?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>零度x&#039;s blog &#187; PostQuitMessage()</title>
	<atom:link href="http://www.lingdux.com/tag/postquitmessage/feed" rel="self" type="application/rss+xml" />
	<link>http://www.lingdux.com</link>
	<description>Take it slowly,it&#039;s OK,it&#039;s OK.</description>
	<lastBuildDate>Tue, 06 Jul 2010 03:50:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>记一次关于GetMessage()的错误</title>
		<link>http://www.lingdux.com/2010/141.html</link>
		<comments>http://www.lingdux.com/2010/141.html#comments</comments>
		<pubDate>Sat, 23 Jan 2010 17:31:35 +0000</pubDate>
		<dc:creator>零度x</dc:creator>
				<category><![CDATA[VC学习]]></category>
		<category><![CDATA[GetMessage()]]></category>
		<category><![CDATA[PostQuitMessage()]]></category>
		<category><![CDATA[错误]]></category>

		<guid isPermaLink="false">http://www.lingdux.com/?p=141</guid>
		<description><![CDATA[今天抛弃MFC写了一个窗口，用while(GetMessage())进入消息循环

在填写GetMessage()的参数的时候，按照VS2008显示的参数进行填写。GetMessage(&#38;msg,hwnd,0,0)

写好回调后编译，运行，结果点退出之后窗体消失，程序并不退出，打开任务管理器发现CPU飙满。

<span class="readmore"><a href="http://www.lingdux.com/2010/141.html" title="记一次关于GetMessage()的错误">阅读全文——共371字</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天抛弃MFC写了一个窗口，用while(GetMessage())进入消息循环</p>
<p>在填写GetMessage()的参数的时候，按照VS2008显示的参数进行填写。GetMessage(&amp;msg,hwnd,0,0)</p>
<p>写好回调后编译，运行，结果点退出之后窗体消失，程序并不退出，打开任务管理器发现CPU飙满。</p>
<p>baidu到一篇和我遇到问题一样，没有解决。</p>
<p>OD载入调试，在GetMessage下断，发现返回-1，加了一句GetLastError()返回0&#215;578,窗体指针无效，豁然开朗。</p>
<p>原来是GetMessage()的第二个参数应该添NULL表示接受所有窗口的消息，我添的是hwnd，DestroyWindow后句柄就无效了，因此GetMessage()返回-1并且进入死循环了。改成NULL就可以正常接收到PostQuitMessage()的消息了！</p>
<p><span id="more-141"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lingdux.com/2010/141.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
