山寨:不是最好的,是最适合我们的!欢迎体验山寨 中文版MSDN

Blog @ Blog

当华美的叶片落尽,生命的脉络才历历可见。 -- 聂鲁达

导航

公告

点击这里给我发消息

留言簿(20)

随笔分类(156)

文章分类(1)

随笔档案(198)

文章档案(2)

相册

阅读排行榜

评论排行榜

常用链接

统计

积分与排名

BBS

Blog

Web

最新评论

AfxBeginThread

于亚杰(281806868) 14:36:55
AfxBeginThread(Load_Map,(LPVOID *)this,THREAD_PRIORITY_NORMAL,0,0,NULL);
于亚杰(281806868) 14:37:12
UINT Load_Map(LPVOID hWnd)
{
 return 0;
}
酱菜Pickle<sunraiing@yahoo.com> 14:39:24
CWinThread* AfxBeginThread(
   AFX_THREADPROC pfnThreadProc,
   LPVOID pParam,
   int nPriority = THREAD_PRIORITY_NORMAL,
   UINT nStackSize = 0,
   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
);

酱菜Pickle<sunraiing@yahoo.com> 14:39:38
pThreadClass
The RUNTIME_CLASS of an object derived from CWinThread.

pParam
Parameter to be passed to the controlling function as shown in the parameter to the function declaration in pfnThreadProc.

nPriority
The desired priority of the thread. If 0, the same priority as the creating thread will be used. For a full list and description of the available priorities, see SetThreadPriority in the Platform SDK.

nStackSize
Specifies the size in bytes of the stack for the new thread. If 0, the stack size defaults to the same size stack as the creating thread.

dwCreateFlags
Specifies an additional flag that controls the creation of the thread. This flag can contain one of two values:

CREATE_SUSPENDED   Start the thread with a suspend count of one. Use CREATE_SUSPENDED if you want to initialize any member data of the CWinThread object, such as m_bAutoDelete or any members of your derived class, before the thread starts running. Once your initialization is complete, use CWinThread::ResumeThread to start the thread running. The thread will not execute until CWinThread::ResumeThread is called.

0   Start the thread immediately after creation.

lpSecurityAttrs
Points to a SECURITY_ATTRIBUTES structure that specifies the security attributes for the thread. If NULL, the same security attributes as the creating thread will be used. For more information on this structure, see the Platform SDK.


酱菜Pickle<sunraiing@yahoo.com> 14:41:06
CWinThread* AfxBeginThread( AFX_THREADPROC pfnThreadProc,
        LPVOID pParam,
        int nPriority = THREAD_PRIORITY_NORMAL,
        UNT nStackSize = 0,
        DWORD dwCreateFlags = 0,
        LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL
       );//用于创建工作者线程

返回值: 一个指向新线程的线程对象
pfnThreadProc : 线程的入口函数,声明一定要如下: UINT MyThreadFunction( LPVOID pParam );
pParam : 传递入线程的参数,注意它的类型为:LPVOID,所以我们可以传递一个结构体入线程.
nPriority : 线程的优先级,一般设置为 0 .让它和主线程具有共同的优先级.
nStackSize : 指定新创建的线程的栈的大小.如果为 0,新创建的线程具有和主线程一样的大小的栈
dwCreateFlags : 指定创建线程以后,线程有怎么样的标志.可以指定两个值:
CREATE_SUSPENDED : 线程创建以后,会处于挂起状态,真到调用: ResumeThread
0 : 创建线程后就开始运行.

posted on 2008-01-30 15:37 isabc 阅读(826) 评论(0)  编辑 收藏 引用 所属分类: VC Function


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理


广告信息(免费广告联系)

中文版MSDN:
欢迎体验