Change thread create API used

Use _beginthreadex() instead of CreateThread() function