⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c++ builder 程序设计实用教程 - 9_3_2 进程应用方法 - 张晋 - 17xie.htm

📁 已经消失的不易找到的C++ builder网络教程总结
💻 HTM
📖 第 1 页 / 共 3 页
字号:
style="FONT: 7pt 'Times New Roman'">         
</SPAN></SPAN></SPAN><SPAN lang=EN-US><FONT 
face="Times New Roman">ThreadId</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">参数表示为每个进程唯一的识别号,当</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">BeginThread</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数返回后,此参数就是进程的识别号。</SPAN></P>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">返回值为该进程的句柄,如果为</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">0</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,表示表示进程没有创建成功,可以调用</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">Windows </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">GetLastError</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数分析错误的原因。</SPAN></P>
<H4 style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT 
face="Times New Roman">2</FONT></SPAN><SPAN 
style="FONT-FAMILY: 楷体_GB2312; mso-ascii-font-family: 'Times New Roman'">.使用进程对象</SPAN></H4>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">利用</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">CBuilder 5 </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">VCL </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">库中</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象。</SPAN></P>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT 
face="Times New Roman">CBuilder 5 </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的一个缺陷是不支持多个进程同时访问它的</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">VCL </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">库,</SPAN><FONT 
face="Times New Roman"> </FONT><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">CBuilder 5 </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的设计者们并没有刻意掩饰这个缺陷,而是专门创建了一个</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象以解决这个问题。</SPAN></P>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象封装了</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">Windows API </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">System </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">单元中有关进程运用的多个函数和例程,利用操作系统分时段给各进程方式控制各个进程的“休眠”与“唤醒”以达到进程工作的同步,当被“唤醒”后就调用</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">Synchronize </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">过程通知主进程,让主进程去真正地访问</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">VCL</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,使得在一个应用程序中同时访问多个</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">VCL </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">库成为了可能。</SPAN></P>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当然,对于进行一般的多进程编程,就更加简单了。</SPAN></P>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在使用上它与</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">CBuilder 5</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中大多数对象不同的是</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread </FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类是一个带有虚拟抽象对象方法的类,我们不能直接创建</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的实例。</SPAN></P>
<P class=MsoNormalIndent style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">必须先声明一个以</SPAN><SPAN 
lang=EN-US><FONT face="Times New Roman">TThread</FONT></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象为基类的类,再用这个派生类创建实例和操纵进程具体的类属性和方法。</SPAN></P>
<P></P></DIV></CENTER>
<HR>
<SPAN id=theurl 
style="FONT-SIZE: 12px">本页地址:http://www.17xie.com/read.php?pid=13928</SPAN> 
</DIV>
<DIV id=read-title style="BORDER-TOP: white 1px solid">
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: right; PADDING-BOTTOM: 8px; PADDING-TOP: 8px">
<TABLE>
  <TBODY>
  <TR>
    <TD><NOBR><SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=1'">|&lt;</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=100'">上一页</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=98'">98</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=99'">99</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=100'">100</SPAN> 
      <SPAN class=page-here 
      onclick="window.location.href='/read.php?bid=303&amp;seq=101'">101</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=102'">102</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=103'">103</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=104'">104</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=102'">下一页</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=105'">&gt;|</SPAN></NOBR>.</TD>
    <TD><INPUT class=input-text 
      onkeydown='if(window.event.keyCode==13)window.location.href="/read.php?bid=303&amp;seq="+this.value' 
      style="WIDTH: 25px"></TD>
    <TD style="PADDING-TOP: 2px">[共105页]</TD></TR></TBODY></TABLE></DIV></DIV>
<DIV id=read-mpage>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 8px; PADDING-TOP: 8px; TEXT-ALIGN: center">[关注本页] 
[在本页中加入书签] [收藏本书] [推荐本书] </DIV></DIV><!-- foot -->
<DIV id=xie_bottom><A class=xie1 href="http://www.17xie.com/help/help-wzjs.html" 
target=_blank>关于我们</A> <SPAN class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/index.html" target=_blank>帮助中心</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m6" target=_blank>版权声明</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m7" target=_blank>免责声明</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m8" target=_blank>联系我们</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m9" target=_blank>友情链接</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/bbs/show_bbs.php?fid=130"><FONT 
color=red>提交意见</FONT></A> <BR>Copyright <SPAN 
style="FONT-FAMILY: arial">©</SPAN> 2007 17xie.com 互联网协同写书平台<BR>
<SCRIPT language=javascript 
src="C++ Builder 程序设计实用教程 - 9_3_2 进程应用方法 - 张晋 - 17xie.files/1261343.js" 
type=text/javascript></SCRIPT>
<NOSCRIPT><A href="http://www.51.la/?1261343" target=_blank><IMG 
style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none" 
alt=我要啦免费统计 
src="C++ Builder 程序设计实用教程 - 9_3_2 进程应用方法 - 张晋 - 17xie.files/go.htm"></A></NOSCRIPT> 
</DIV></DIV>
<SCRIPT>			setInterval("ajax_sr('/live.php','')",600000);			function chcolor(sz)			{				$('read-conts').style.backgroundColor = sz;			}						function clcp()			{				var rng = document.body.createTextRange();		        rng.moveToElementText(document.getElementById("theurl"));		        rng.execCommand("Copy");			}			document.body.onkeydown = clcp;			document.body.onmouseout = clcp;			document.body.onclick = clcp;					</SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -