This function creates a thread to execute within the address space of the calling process.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
这个函数的功能是在调用进程的地址空间创建一个线程。
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpsa,
DWORD cbStack,
LPTHREAD_START_ROUTINE lpStartAddr,
LPVOID lpvThreadParam,
DWORD fdwCreate,
LPDWORD lpIDThread
);
?Parameters
参数
lpsa
[in] Ignored. Must be NULL.
[输入]被忽略的。必须是NULL
cbStack
[in] Ignored unless the STACK_SIZE_PARAM_IS_A_RESERVATION flag is used. In that case, this parameter specifies the virtual memory reserved for the new thread.
[输入]被忽略,除非使用STACK_SIZE_PARAM_IS_A_RESERVATION标志位,在这种情况下,这个参为新的线程指定虚拟内存。
When ignored, the default stack size for a thread is determined by the linker setting /STACK.
当忽略该参数,默认的线程堆栈大小由连接器设置决定
lpStartAddr
[in] Long pointer to the application-defined function of type LPTHREAD_START_ROUTINE to be executed by the thread; represents the starting address of the thread. For more information on the thread function, see ThreadProc.
[输入] 长指针,指向类型为LPTHREAD_START_ROUTINE的应用程序定义的函数(线程函数),该函数被线程所调用。代表线程的开始地址。欲了解线程函数的更多信息,请查阅ThreadProc。
Note:
It is invalid to set lpStartAddr to NULL. If this value is passed in the parameter, the function will return ERROR_INVALID_PARAMETER.
注释:
设置lpStartAddr为NULL表示无效,如果NULL被传递,这个函数将返货ERROR_INVALID_PARAMETER。
lpvThreadParam
[in] Long pointer to a single 32-bit parameter value passed to the thread.
[输入]指向一个32位的参数,传递给线程。
fdwCreate
[in] Specifies flags that control the creation of the thread.
[输入]指定控制创建线程的标志。
The following table shows the values for this parameter.
下表列出了这个参数的值。
Value
Description
CREATE_SUSPENDED
The thread is created in a suspended state and does not run until the ResumeThread function is called.
The thread can be run immediately after creation if the flag is not specified.
线程处于浮动状态,直到调用ResumeThread函数,该线程才运行。
如果没有指定该标志位,该线程创建后将立即运行。
STACK_SIZE_PARAM_IS_A_RESERVATION
The cbStack parameter specified the maximum stack size instead of being ignored.
CbStack将不被忽略,指定最大堆栈大小。
This is a Windows Embedded CE only flag for the CreateThread function and is used to reserve the stack size for the thread created.
该标志是wince嵌入操作系统对CreateThread函数独有的,被用来指定创建线程的保留堆栈大小。
By default, a thread is created with 64 KB stack reserved. You can use this flag to increase the stack size for the new thread that was created.
默认,被创建线程与保留64KB大小的堆栈,你可以使用该标志,为创建的线程增加堆栈大小
lpIDThread
[out] Long pointer to a 32-bit variable that receives the thread identifier. If this parameter is NULL, the thread identifier is not returned.
[输出]指向一个32为的变量,用于接收线程标志符。如果该参数为NULL,则线程标志符不会返回。
文章评论(0条评论)
登录后参与讨论