#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 );
}
}
![]()
posted @
2006-06-21 16:55
Rookie.Zhang
阅读(
3615)
评论()
收藏
举报