Ah, thats what I thought the problem was to start with (thanks), I guess it probably is.
I'll try and post what I think the relevant code is: (the whole code is around 6000 lines)
declarations:
Code:
DWORD WINAPI Play(LPVOID);
int PlayHome(void);
TABLE PlaySeenHand(TABLE);
TABLE g_table[MAX_TABLES];
int g_nTables;
Main window procedure that starts thread 'Play'
Code:
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDB_DEAL:
{
// start Dealer Control thread
hThread = CreateThread(NULL, 0, Play , NULL, 0, &dwThreadId);
if(hThread == NULL)
{
MessageBox(hwnd, "Thread Failed", ":-(", MB_OK);
SendMessage(hwnd, WM_CLOSE, 0, 0L);
}
CloseHandle(hThread);
}
}
Play thread:
Code:
DWORD WINAPI Play(LPVOID lParam)
{
int i;
switch(g_gameType)
{
case HOME:
return PlayHome();
default:
return -1;
}
}
int PlayHome()
{
int x;
char txt[200];
for(x=0; x<g_nTables; x++)
// THIS IS WHERE THE ERROR OCCURRS (the code doesn't reah line 1 of PlaySeenHand();
g_table[x] = PlaySeenHand(g_table[x]);
// see how many players are left
if(g_table[0].nActivePlayers == 1)
{
for(x=0; x<g_table[0].nPlayers; x++)
{
if(g_table[0].player[x].playing == TRUE)
{
char msg[30];
wsprintf(msg, "%s wins the game!!", g_table[0].player[x].name);
MyMessageBox(msg, TRUE, FALSE);
return 1;
}
}
}
btnDeal.enabled = TRUE;
btnDeal.mouseState = OFF;
DrawButton(btnDeal, g_hdcBuffer);
return 0;
}
Thanks again