From: serg k. <in...@mt...> - 2000-10-14 17:48:40
|
Hi, all! ==========working code (without CloseHandle)============== #include <stdio.h> #include <errno.h> #include <process.h> #include <windows.h> /*** __stdcall definition ***/ typedef unsigned (__stdcall * PTR_FUNC) (void *); /*** for DEBUG ***/ char debug[1024]; /*** func defs ***/ void WINAPI THREAD_TEST (const int); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int thread_id; int param=12345; MessageBox(NULL, "", "before...", MB_OK); if (_beginthreadex ( NULL, (unsigned) 128*1024, /* STKSIZE = 128K, e.g. */ (PTR_FUNC) THREAD_TEST, (void *) param, (unsigned) 0, (unsigned *)&thread_id ) == 0) { sprintf (debug, "_beginthreadex: %s", strerror (errno)); MessageBox(NULL, debug, "error(s)...", MB_OK); return (1); } MessageBox(NULL, "", "after...", MB_OK); return (0); } void WINAPI THREAD_TEST (const int i) { sprintf (debug, "param=%d", i); MessageBox(NULL, debug, "inthread", MB_OK); _endthreadex (0); } ================================== thank you! wbr, abn |