|
-
May 3rd, 1999, 07:51 PM
#1
AfxBeginThread - Threads and Doc/View
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
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|