المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : UINT ThreadProc(LPVOID param)



C++ Programming
07-31-2009, 04:50 PM
Can you tell me please how can call or access a global variable or a function defined in th Doc.cpp or anyaother class from inside UINT ThreadProc (LPVOID param)?

UINT ThreadProc(LPVOID param)
{
CTestDoc* pDoc = GetDocument(); // error: GetDocument() is not defined???
ASSERT_VALID(pDoc);

::WaitForSingleObject(m_Thread_Sel_Start.m_hObject , INFINITE);

::MessageBox((HWND)param, strThread_Start, strThread_Caption, MB_OK);

CSQLCommand::FindSQLCmd(pDoc,m_strSelect);// error :m_strSelect is defined in the CTestView.h but he can not find it , pDoc is already unkown

bool bKeepRunning = true;

while(bKeepRunning)
{
int nResult = ::WaitForSingleObject (m_Thread_Sel_End.m_hObject ,0);

if(nResult == WAIT_OBJECT_0)
bKeepRunning = false;
}

::PostMessage((HWND)param, WM_THREADENDED, 0, 0);

return 0;
}

Can i define the UINT ThreadProc(LPVOID param) in the CTestDoc.cpp?
And why when i declare UINT ThreadProc(LPVOID param) in the CTestView.h i get this error:
error C3867: "CTestView::ThreadProc": use "&CTestView::ThreadProc".

and when i use &CTestView::ThreadProc i get a csting problem that can not be solved through an explict cast.