当前位置: 移动技术网 > 科技>操作系统>windows > 进程与线程的创建

进程与线程的创建

2019年02月28日  | 移动技术网科技  | 我要评论

147学生尿汞超标,5000到350万炒股手记,郑福中

// tmpthread.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;

//线程函数
dword winapi startaddress(lpvoid lpparameter)
{
cout << "\ni am a very simple thread!" <<endl;
return 0;
}

int main()
{
//创建进程
startupinfo startupinfo = { 0 };
process_information processinfo = { 0 };
bool bsuccess = createprocess(l"..\\debug\\tmpprocess.exe", null, null, null, false, null, null, null,
&startupinfo, &processinfo);
if (bsuccess)
{
cout << "\nprocess running successed!" << endl;
}
else

{
cout << "\nprocess running faild!" << endl;
}

//创建线程
handle hthread = createthread(null, 0, /*(lpthread_start_routine)*/startaddress, null, null, null);

waitforsingleobject(hthread,infinite);//等待线程执行完在执行后续代码
closehandle(hthread);
system("pause");
return 0;
}

 

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网