OK, ive read alot of posts lately from people who are having problems getting a threaded application up and running, so I figured Id write a short tutorial about windows threads (mit source code chocolate chunks even).
The following will start a single thread.
Code:
#include <windows.h>
int main(){
HANDLE hThread;
DWORD ThreadId;
DWORD SomeData;
hThread = CreateThread(NULL , 0 , &ThreadFunc , &SomeData , 0 , &ThreadId);
WaitForSingleObject(hThread , INFINITE);
return 0;
}
DWORD WINAPI ThreadFunc(LPVOID lParam){
DWORD TheData;
TheData = (DWORD)*lParam;
// your code goes here
return 0;
}
nothing fancy, it just creates the thread and waits for it to terminate.