RunModalLoop thread

Hi!

I click on a button and a popup(style) dialog appears. I then call a runmodalloop function which recieves a certain amount of data and after it finishes the main window refreshes and shows the data. What i would like to do is, have access to the main window while the runmodallloop is active ( dialog runs in the background). I tried with starting a new thread, and putting the function in it but it won't give me access. Afterwards i made the dialog as a child and set the main wnd as the parent.And after the child finished with the modal loop the program frooze.

Code:

CWinThread *pThread2 = AfxBeginThread(CMainWnd::GetData, &dialog,0,CREATE_SUSPENDED);
pThread2->Run();

UINT CMainWnd::GetData(LPVOID lpDialog)
{
ASSERT( lpDeliverWizard);
CDialog *dialog1 = (CDialog *) lpDialog;
CWnd * hwnd = dialog1->GetOwner();
dialog1->SetParent(hwnd);
dialog1->RunModalLoop();
return 0;

}

Any suggestions?
Topic archived. No new replies allowed.