_beginthread函数解释及实例应用
(2017-05-13 16:36:04)
标签:
it编程程序 |
分类: 编程语言 |
_beginthread函数解释及实例应用
_beginthread
uintptr_t _beginthread(
);
Parameters 参数:
start_address:程序执行一个新线程的起始地址
Start address of a routine that begins execution of a new
thread. For _beginthread, the calling convention is either __cdecl
or __clrcall; for _beginthreadex, it is either __stdcall or
__clrcall.
stack_size:新线程的堆栈大小或0
Stack size for a new thread or 0.
Arglist:传给新线程的变量清单或空
Argument list to be passed to a new thread or NULL.
Return Value 返回值:
如果新线程建立成功,函数返回该线程的句柄;然而,如果新线程退出太快,_beginthread函数可能返回一个有误的句柄。_beginthread发生错误时返回1L。
If successful, function returns a handle to the newly created
thread; however, if the newly created thread exits too quickly,
_beginthread might not return a valid handle. _beginthread returns
1L on an error, in which case errno is set to EAGAIN if there are
too many threads, to EINVAL if the argument is invalid or the stack
size is incorrect, or to EACCES in the case of insufficient
resources (such as memory).
Requirements 要求:
Routine(程序)
Required header(需要的头文件)
_beginthread
Example 举例:
下面举例教您使用_beginthread
// crt_BEGTHRD.C
// 编译: /MT /D "_X86_" /c
// 处理器: x86
#include
#include
#include
#include
#include
void Bounce( void *ch );
void CheckKey( void *dummy );
#define GetRandom( min, max ) ((rand() % (int)(((max) + 1) -
(min))) + (min))
BOOL repeat = TRUE;
HANDLE hStdOut;
CONSOLE_SCREEN_BUFFER_INFO csbi;
int main()
{
}
void CheckKey( void *dummy )
{
}
void Bounce( void *ch )
{
}
前一篇:如何提高程序的运行效率
后一篇:MFC 日期显示