<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head id="Head"><title>
VC多线程编程(转) - 中国龍 - 博客园
</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta id="metaKeywords" name="keywords" content="VC多线程编程,转" /><meta name="description" content="VC中多线程使用比较广泛而且实用,在网上看到的教程.感觉写的挺好.一、问题的提出编写一个耗时的单线程程序: 新建一个基于对话框的应用程序SingleThread,在主对话框IDD_SINGLETHREAD_DIALOG添加一个按钮,ID为IDC_SLEEP_SIX_SECON" /><link id="CommondCss" type="text/css" rel="stylesheet" href="http://www.cnblogs.com/css/common.css" /><link id="MainCss" type="text/css" rel="stylesheet" href="http://www.cnblogs.com/Skins/arrow/style.css" /><link id="CommondCss2" type="text/css" rel="stylesheet" href="http://www.cnblogs.com/css/common2.css" /><link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/huqingyu/rss" /><link id="RSDLink" title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/huqingyu/rsd.xml" />
<script src="/Script/common.js" type="text/javascript"></script>
</head>
<body>
<form name="Form1" method="post" action="801923.html" onsubmit="javascript:return WebForm_OnSubmit();" id="Form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="
__VIEWSTATE" value="" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=PyW-m2hLmppJ9byT1bYEqw2&t=633595624754539605" type="text/javascript"></script>
<script language=JavaScript>
function ctlent(evt,id)
{
if(evt.ctrlKey && evt.keyCode == 13)
{
try
{
TempSave(id);
}
catch(ex)
{
}
finally
{
__doPostBack('AjaxHolder$PostComment$btnSubmit','')
}
}
}</script>
<script language=JavaScript>function SetReplyAuhor(author){document.getElementById('AjaxHolder_PostComment_tbComment').value+="@"+author+"\n";document.getElementById('AjaxHolder_PostComment_tbComment').focus();return false}</script>
<script src="/ScriptResource.axd?d=Io4r5Qx-zmHVyf9RpZLpA94PR0yylGVrHR75KduCbtx9Wbjv2jQEzXmeH0no0z7nxVOXJo-onw_3WI2pcwKr3w2&t=2874222d" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=Io4r5Qx-zmHysvkgwLW9yo8n3Qy8mF1pKqiy9F9NsaumPVHFacuhdQt4up9TNXjhpSnd506dqHs9Jav4BBe5ng_SoSXKbTPC0&t=ffffffff87f27a50" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=Io4r5Qx-zmHysvkgwLW9yo8n3Qy8mF1pKqiy9F9NsaumPVHFacuhdQt4up9TNXjhpSnd506dqHuVutGEt8Q_paTgZmcLbiAFK3DP9oKhStQ1&t=ffffffff87f27a50" type="text/javascript"></script>
<script src="../../../../../WS/AjaxWS.asmx/js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
<img src="http://services.nexodyne.com/email/icon/%2BWZOZgDk7eI%3D/lGZ8QEY%3D/R01haWw%3D/0/image.png">
<!--done-->
<div id="header">
<!--done-->
<div class="header">
<div class="headerText">
<a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/huqingyu/">中国龍</a><br>
=============龖:龍腾飞的样子=============
</div>
</div>
</div>
<div id="mylinks">
<!--done-->
<a id="MyLinks1_HomeLink" class="menu" href="http://www.cnblogs.com/">博客园</a>
<a id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/huqingyu/">首页</a>
<a id="MyLinks1_NewPostLink" class="menu" href="http://www.cnblogs.com/huqingyu/admin/EditPosts.aspx?opt=1">新随笔</a>
<a id="MyLinks1_ContactLink" accesskey="9" class="menu" href="http://www.cnblogs.com/huqingyu/contact.aspx?id=1">联系</a>
<a id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/huqingyu/rss">订阅</a><a id="MyLinks1_XMLLink" href="http://www.cnblogs.com/huqingyu/rss"><img src="http://www.cnblogs.com/images/xml.gif" alt="订阅" style="border-width:0px;" /></a>
<a id="MyLinks1_Admin" class="menu" href="http://www.cnblogs.com/huqingyu/admin/EditPosts.aspx">管理</a>
</div>
<div id="mytopmenu">
<div class="blogStats">随笔 - 990
文章 - 84 评论 - 614 trackbacks - 43
</div>
</div>
<div id="leftcontent">
<DIV id="leftcontentcontainer">
<table id="Calendar1_entryCal" class="Cal" cellspacing="0" cellpadding="0" title="Calendar" border="0" style="border-width:1px;border-style:solid;border-collapse:collapse;border:0px">
<tr><td colspan="7" style="background-color:Transparent;"><table class="CalTitle" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;">
<tr><td class="CalNextPrev" style="width:15%;"><a href="javascript:__doPostBack('Calendar1$entryCal','V2708')" style="color:Black" title="Go to the previous month"><</a></td><td align="center" style="width:70%;">2007年7月</td><td class="CalNextPrev" align="right" style="width:15%;"><a href="javascript:__doPostBack('Calendar1$entryCal','V2769')" style="color:Black" title="Go to the next month">></a></td></tr>
</table></td></tr><tr><th class="CalDayHeader" align="center" abbr="日" scope="col">日</th><th class="CalDayHeader" align="center" abbr="一" scope="col">一</th><th class="CalDayHeader" align="center" abbr="二" scope="col">二</th><th class="CalDayHeader" align="center" abbr="三" scope="col">三</th><th class="CalDayHeader" align="center" abbr="四" scope="col">四</th><th class="CalDayHeader" align="center" abbr="五" scope="col">五</th><th class="CalDayHeader" align="center" abbr="六" scope="col">六</th></tr><tr><td class="CalOtherMonthDay" align="center" style="width:14%;">24</td><td class="CalOtherMonthDay" align="center" style="width:14%;">25</td><td class="CalOtherMonthDay" align="center" style="width:14%;">26</td><td class="CalOtherMonthDay" align="center" style="width:14%;">27</td><td class="CalOtherMonthDay" align="center" style="width:14%;">28</td><td class="CalOtherMonthDay" align="center" style="width:14%;">29</td><td class="CalOtherMonthDay" align="center" style="width:14%;">30</td></tr><tr><td class="CalWeekendDay" align="center" style="width:14%;">1</td><td align="center" style="width:14%;">2</td><td align="center" style="width:14%;">3</td><td align="center" style="width:14%;">4</td><td align="center" style="width:14%;">5</td><td align="center" style="width:14%;">6</td><td class="CalWeekendDay" align="center" style="width:14%;">7</td></tr><tr><td class="CalWeekendDay" align="center" style="width:14%;">8</td><td align="center" style="width:14%;">9</td><td align="center" style="width:14%;">10</td><td align="center" style="width:14%;">11</td><td align="center" style="width:14%;">12</td><td align="center" style="width:14%;">13</td><td class="CalWeekendDay" align="center" style="width:14%;">14</td></tr><tr><td class="CalWeekendDay" align="center" style="width:14%;">15</td><td align="center" style="width:14%;">16</td><td align="center" style="width:14%;">17</td><td align="center" style="width:14%;">18</td><td align="center" style="widt