古詩詞大全網 - 成語查詢 - _beginthreadex 傳參數

_beginthreadex 傳參數

函數原型:

unsigned long _beginthreadex(

void *security,

unsigned stack_size,

unsigned ( __stdcall *start_address )( void * ),

void *arglist, /* 這個就是傳給線程函數的參數的指針 */

unsigned initflag,

unsigned *thrdaddr );

HANDLE ha = (HANDLE)_beginthreadex(0,0,(unsigned int (__stdcall *)(void *))show,(LPVOID)&a,0,0);

unsigned int __stdcall show(LPVOID lpvoid)

{

int a= *(int *)lpvoid;/*需要傳多個參數的時候,使用結構體*/

printf("OK........\n");

return 0;

}