#include "stdafx.h" #undef UNICODE #include #include using namespace std; DWORD WINAPI f (void * param) { int n = (int) param; while (true) { // Sleep (100); cout << "Hello from thread " << n << endl; } return 0; } int _tmain(int argc, _TCHAR* argv[]) { for (int i = 1; i <= 3; i++) { HANDLE h; h = CreateThread (NULL, // security attr 0, // stack f, (void*) i, // function parameter 0, // flags NULL) ; // thread id if (h == NULL) cout << "Chyba" << endl; else CloseHandle (h); } cout << "Stop" << endl; char s [2]; cin.getline (s, sizeof (s)); return 0; }