May 3rd, 1999, 07:51 PM
I am using the Document View Architecture and starting a Thread using AfxBeginThread(WorkerThread, pParam);
When I am in the WorkerThread how can I access a method in my View Class. I have tryed the following:
CMainFrame *pMainFrame = (CMainFrame *)AfxGetMainWnd();
CFrameWnd* pChild = pMainFrame->GetActiveFrame();
CServerView* pView = (CServerView*)pChild->GetActiveView();
// The method I am tryitng call from the Thread
pView->WriteLogMessage(szMessage);
This will fail with a Access Violation on the call to GetActiveFrame()
I have also tryed throught about used CWnd::PostMessage();
Any comments would be appreciated!
Thanks,
Chris Macgowan
macgowan@pobox.com
When I am in the WorkerThread how can I access a method in my View Class. I have tryed the following:
CMainFrame *pMainFrame = (CMainFrame *)AfxGetMainWnd();
CFrameWnd* pChild = pMainFrame->GetActiveFrame();
CServerView* pView = (CServerView*)pChild->GetActiveView();
// The method I am tryitng call from the Thread
pView->WriteLogMessage(szMessage);
This will fail with a Access Violation on the call to GetActiveFrame()
I have also tryed throught about used CWnd::PostMessage();
Any comments would be appreciated!
Thanks,
Chris Macgowan
macgowan@pobox.com