| 发表于:2008-02-13 12:17:386楼 得分:0 |
我能否按如下的方式去做 说明:handle hthread[2];是mydlg类的变量 void mydlg::start_thread() { //开启通讯线程1 hthread[0]=createthread(null, 0, thread_proc_tongxun1, this, 0, null); //开启通讯线程2 hthread[1]=createthread(null, 0, thread_proc_tongxun2, this, 0, null); //开启通讯线程3 handle hthread hthread=(null, 0, thread_proc_tongxun3, this, 0, null); //调用一个非模态对话框,给用户显示一些提示信息 dlg_msg my_msg_dlg;//定义界面提示对话框 my_msg_dlg.domodal();//显示对话框 closehandle(hthread[0]); closehandle(hthread[1]); closehandle(hthread); } dword winapi thread_proc_tongxun1(lpvoid lpparameter) { 线程1执行 } dword winapi thread_proc_tongxun2(lpvoid lpparameter) { 线程2执行 } dword winapi thread_proc_tongxun3(lpvoid lpparameter) { //要求线程3在线程1和线程2执行完毕后,才执行线程3的程序 ::waitformultipleobjects(2, &hthread, true, infinite); 线程3执行 } | | |
|