#include
<
windows.h
>
#include
<
conio.h
>

DWORD WINAPI ThreadFunc()
//
LPVOID lpParam )
{
char szMsg[80];
//wsprintf( szMsg, "Parameter = %d.", *(DWORD*)lpParam );
MessageBox( NULL, "szMsg", "ThreadFunc", MB_OK );
return 0;
}
VOID main( VOID )
{
DWORD dwThreadId, dwThrdParam = 1;
HANDLE hThread;
char szMsg[80];
hThread = CreateThread(
NULL, // default security attributes
0, // use default stack size
(LPTHREAD_START_ROUTINE)ThreadFunc, // thread function
NULL, // argument to thread function
0, // use default creation flags
&dwThreadId); // returns the thread identifier
// Check the return value for success.
if (hThread == NULL)
{
wsprintf( szMsg, "CreateThread failed." );
MessageBox( NULL, szMsg, "main", MB_OK );
}
else
{
_getch();
CloseHandle( hThread );
}
}


862

被折叠的 条评论
为什么被折叠?



