There's this function on _beginthreadex MSDN page:
unsigned __stdcall SecondThreadFunc( void* pArguments )
{
    printf( "In second thread...\n" );
    while ( Counter < 1000000 )
    Counter++;
    _endthreadex( 0 );
    return 0;
}
I know you can get the value returned by _endthreadex with the function GetExitCodeThread, but how do you get the value returned by return?
Another question: doesn't _endthreadex end the thread, why did they put a return 0 after that?
 
                        
return 0is there just to make the compiler happy._endthreadexdoes not return.