Hi,

I've a problem, which i don't know how to solve.

I've a class LoginDlg, which is defined this way
Code:
class LoginDlg : public CDialog
Dialog has one button, which has method
Code:
void LoginDlg::OnBnClickedOk()
In this method a I create a Thread
Code:
pLoginThread = AfxBeginThread(LogIn, myUserInfo, THREAD_PRIORITY_NORMAL);
I want to call OnOK() method after pLoginThread finish its job. Part of code is:
Code:
UINT LogIn(LPVOID lParam) {
  // Any code... (Downloading file)
  return 1;
}
void LoginDlg::OnBnClickedOk() {
  CWinThread* pLoginThread = AfxBeginThread(LogIn, myUserInfo, THREAD_PRIORITY_NORMAL); 
  // If i write OnOK() here, it doesn't wait on finishing thread 
}
I really don't know, how to do it. So please, help me