Hi!
I'm new to multithreading and developing in VC++ 6 directly with the win32 API.
In console mode, the usual code to create another thread and use it runs well in my system, but I have no success when using WinMain, like in the very simple code below:
Code:
int globalval;
void __cdecl TestThread( void* param ){ globalval=10; }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE,
PSTR szCmdLine, int nCmdShow )
{
globalval = 5;
_beginthread( TestThread, 0, (void*)NULL );
CreateMyWindows(hInstance);
MSG mess;
while( GetMessage(&mess,0,0,0) )
{
TranslateMessage( &mess );
DispatchMessage( &mess );
}
return mess.wParam;
}
I go past the _beginthread call and it even returns a thread number, but apparently TestThread doesn't run at all, because globalval doesn't change. Then after the first call to GetMessage I get the error message "R6016 not enough space for thread data".
Yes, I have VC6 with project set for run-time library "Debugging Multithread".
Any ideas?
Thanks a lot,
Rick Trelles