cwinthread* afxbeginthread( 【推荐阅读:Visual C++ 编译器选项】
int npriority = thread_priority_normal,//线程优先级 【扩展信息:Quick and Dirty Seri】 lpvoid pparam,//线程参数 uint nstacksize = 0,//线程堆栈大小,默认为1m dword dwcreateflags = 0,// lpsecurity_attributes lpsecurityattrs = null );cwinthread* afxbeginthread(
cruntimeclass* pthreadclass, int npriority = thread_priority_normal, uint nstacksize = 0, dword dwcreateflags = 0, lpsecurity_attributes lpsecurityattrs = null );参数说明:
pfnthreadproc:线程函数的地址,该参数不能设置为null,线程函数必须定义成全局函数或者类的静态成员函数例如:uint mythreadfunc(lpvoid lparam)或者class a{public: static uint __stdcall mythreadfunc(lpvoid lparam);}之所以要定义成类的静态成员函数,是因为类的静态成员函数不属于某个类对象,这样在调用函数的时候就不用传递一个额外的this指针.pthreadclass:指向从cwinthread派生的子类对象的runtime_class
pparam:要传递给线程函数的参数
npriority:要启动的线程的优先级,默认优先级为thread_priority_normal(普通优先级),关于线程
优先级的详细说明请参考platform sdk setthreadpriority函数说明nstacksize:新线程的堆栈大小,如果设置为0,则使用默认大小,在应用程序中一般情况下线程的默认堆栈大小
为1m... 下一页