VC学习一日一练(3)---MFC中使用多线程技术
2007-11-26 10:03
387 查看
创建线程函数:
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
Parameters
lpThreadAttributes
[in] Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited.
The lpSecurityDescriptor member of the structure specifies a security descriptor for the new thread. If lpThreadAttributes is NULL, the thread gets a default security descriptor. The ACLs in the default security descriptor for a thread come from the primary token of the creator.
dwStackSize
[in] Initial size of the stack, in bytes. The system rounds this value to the nearest page. If this parameter is zero, the new thread uses the default size for the executable.
//设置线程初始栈的大小,即线程可以将多少地址空间用于它自己的栈,以字节为单位,系统会把这个参数四舍五入为最近页面的大小。
//页面是OS管理内存时使用的内存单位,不同CPU其页面大小不同,x86使用的页面大小是4KB。当保留地址空间的一块区域的同时,系统
//确保该区域的大小是系统页面大小的倍数
lpStartAddress
[in] Pointer to the application-defined function to be executed by the thread and represents the starting address of the thread.
lpParameter
[in] Pointer to a variable to be passed to the thread. //指向传递给线程的变量
dwCreationFlags
[in] Flags that control the creation of the thread. If the CREATE_SUSPENDED flag is specified, the thread is created in a suspended state, and will not run until the ResumeThread function is called. If this value is zero, the thread runs immediately after creation.
lpThreadId
[out] Pointer to a variable that receives the thread identifier. If this parameter is NULL, the thread identifier is not returned.
//接收thread identifier(线程标示符,线程ID)的指针
Windows Me/98/95: This parameter may not be NULL.
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
Parameters
lpThreadAttributes
[in] Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited.
The lpSecurityDescriptor member of the structure specifies a security descriptor for the new thread. If lpThreadAttributes is NULL, the thread gets a default security descriptor. The ACLs in the default security descriptor for a thread come from the primary token of the creator.
dwStackSize
[in] Initial size of the stack, in bytes. The system rounds this value to the nearest page. If this parameter is zero, the new thread uses the default size for the executable.
//设置线程初始栈的大小,即线程可以将多少地址空间用于它自己的栈,以字节为单位,系统会把这个参数四舍五入为最近页面的大小。
//页面是OS管理内存时使用的内存单位,不同CPU其页面大小不同,x86使用的页面大小是4KB。当保留地址空间的一块区域的同时,系统
//确保该区域的大小是系统页面大小的倍数
lpStartAddress
[in] Pointer to the application-defined function to be executed by the thread and represents the starting address of the thread.
lpParameter
[in] Pointer to a variable to be passed to the thread. //指向传递给线程的变量
dwCreationFlags
[in] Flags that control the creation of the thread. If the CREATE_SUSPENDED flag is specified, the thread is created in a suspended state, and will not run until the ResumeThread function is called. If this value is zero, the thread runs immediately after creation.
lpThreadId
[out] Pointer to a variable that receives the thread identifier. If this parameter is NULL, the thread identifier is not returned.
//接收thread identifier(线程标示符,线程ID)的指针
Windows Me/98/95: This parameter may not be NULL.
相关文章推荐
- 这是我学习COM遇到的几个基本问题其解决 黄森堂(vcmfc)著 1.我用ATL生成一个组件对象,我在COM中使用IDD_IEncrypt,这个在哪里写义,是啥?GUID? 答:IDD_IEncry
- VC学习一日一练(2)---MFC中自定义消息
- 【转】VC++/MFC(VC6)开发技术精品学习资料下载汇总 (2011.3.10更新)
- solidworks二次开发 学习日记--3使用solidworks sdk api 和vc做简单开发
- 多线程编程学习3——使用MFC工作者线程
- [技术学习]VC++ 的MFC 和ATL 及COM 是什么?
- VC++/MFC(VC6)开发技术精品学习资料下载汇总
- 在VS2013 中使用VC 6.0 编写的MFC 程序
- [转]使用VC/MFC创建一个线程池
- VC++MFC中在初始化窗口过程中不要过早使用GetWindowRect
- MFC vc++ 一些 API 的使用
- VC-使用MFC的数组类
- MFC学习笔记之:ListCtrl控件使用详解
- 关于VC、MFC和ACCESS的一些使用问题
- VC MFC如何使用Console输出调试信息..
- MFC关于CBimtap类的使用和创建位图数组的问题【学习笔记】
- VC/MFC之TreeCtrl控件使用经验总结
- Vc/MFC中自定义消息及其PostMessage触发使用
- VC++/MFC(VC6)开发技术精品学习资料分享
- 【C】VC++ 6.0经典C语言学习小工具的使用