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

📄 subject_17404.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:17404 发表者:精灵老豆 发表日期:2002-10-11 10:26:40
<br>主题:请问有关多线程的问题
<br>内容:#include "windows.h"<BR>#include "process.h"<BR>#include "stdio.h"<BR><BR>unsigned int __stdcall function(void * pParam)<BR>{<BR>&nbsp;&nbsp;DWORD val = 0;<BR><BR>&nbsp;&nbsp;return val;<BR>}<BR>int main()<BR>{<BR>&nbsp;&nbsp;DWORD dwError = 0;<BR>&nbsp;&nbsp;void * hThread = _beginthreadex(0, 0, function, 0, 0, 0);<BR>&nbsp;&nbsp;if (!hThread) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;dwError = GetLastError();<BR>&nbsp;&nbsp;&nbsp;&nbsp;printf("ErrorID is %d", dwError);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;getch();<BR>}<BR>&nbsp;&nbsp;这个程序在2K下面运行完好,但是在98下面却有问题,返回值为87,查了一下为参数问题。请高手解答。<BR><BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:精灵老豆 回复日期:2002-10-11 10:34:04
<br>内容:修正一下<BR>#include "windows.h"<BR>#include "process.h"<BR>#include "stdio.h"<BR><BR>unsigned int __stdcall function(void * pParam)<BR>{<BR>&nbsp;&nbsp;DWORD val = 0;<BR><BR>&nbsp;&nbsp;return val;<BR>}<BR>int main()<BR>{<BR>&nbsp;&nbsp;DWORD dwError = 0;<BR>&nbsp;&nbsp;void * hThread = _beginthreadex(0, 0, function, 0, 0, 0);<BR>&nbsp;&nbsp;WaitForSingleObject(hThread, INFINITE);<BR>&nbsp;&nbsp;if (!hThread) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;dwError = GetLastError();<BR>&nbsp;&nbsp;&nbsp;&nbsp;printf("ErrorID is %d", dwError);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;<BR>}<BR>&nbsp;&nbsp;这个程序在2K下面运行完好,但是在98下面却有问题,返回值为87,查了一下为参数问题。请高手解答。<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:精灵老豆 回复日期:2002-10-11 10:52:43
<br>内容:已经解决。呵呵。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:jackyxio 回复日期:2002-10-11 10:53:16
<br>内容:BYTE byValues[100];<BR><BR>_beginthreadex(NULL,0,( __stdcall *start_address)function,NULL,0,byValues);<BR><BR>试一下!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

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